
_usertests:     file format elf32-i386


Disassembly of section .text:

00000000 <main>:
  printf(1, "fork test OK\n");
}

int
main(int argc, char *argv[])
{
       0:	55                   	push   %ebp
       1:	89 e5                	mov    %esp,%ebp
       3:	83 e4 f0             	and    $0xfffffff0,%esp
       6:	83 ec 10             	sub    $0x10,%esp
  printf(1, "usertests starting\n");
       9:	c7 44 24 04 c7 3d 00 	movl   $0x3dc7,0x4(%esp)
      10:	00 
      11:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
      18:	e8 33 2e 00 00       	call   2e50 <printf>

  if(open("usertests.ran", 0) >= 0){
      1d:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
      24:	00 
      25:	c7 04 24 db 3d 00 00 	movl   $0x3ddb,(%esp)
      2c:	e8 13 2d 00 00       	call   2d44 <open>
      31:	85 c0                	test   %eax,%eax
      33:	78 19                	js     4e <main+0x4e>
    printf(1, "already ran user tests -- rebuild fs.img\n");
      35:	c7 44 24 04 28 43 00 	movl   $0x4328,0x4(%esp)
      3c:	00 
      3d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
      44:	e8 07 2e 00 00       	call   2e50 <printf>
    exit();
      49:	e8 b6 2c 00 00       	call   2d04 <exit>
  }
  close(open("usertests.ran", O_CREATE));
      4e:	c7 44 24 04 00 02 00 	movl   $0x200,0x4(%esp)
      55:	00 
      56:	c7 04 24 db 3d 00 00 	movl   $0x3ddb,(%esp)
      5d:	e8 e2 2c 00 00       	call   2d44 <open>
      62:	89 04 24             	mov    %eax,(%esp)
      65:	e8 c2 2c 00 00       	call   2d2c <close>

  opentest();
      6a:	e8 81 00 00 00       	call   f0 <opentest>
  writetest();
      6f:	e8 1c 01 00 00       	call   190 <writetest>
  writetest1();
      74:	e8 17 03 00 00       	call   390 <writetest1>
  createtest();
      79:	e8 02 05 00 00       	call   580 <createtest>
      7e:	66 90                	xchg   %ax,%ax

  mem();
      80:	e8 6b 0a 00 00       	call   af0 <mem>
  pipe1();
      85:	e8 d6 06 00 00       	call   760 <pipe1>
  preempt();
      8a:	e8 71 08 00 00       	call   900 <preempt>
      8f:	90                   	nop
  exitwait();
      90:	e8 cb 09 00 00       	call   a60 <exitwait>

  rmdot();
      95:	e8 56 24 00 00       	call   24f0 <rmdot>
  fourteen();
      9a:	e8 f1 22 00 00       	call   2390 <fourteen>
      9f:	90                   	nop
  bigfile();
      a0:	e8 fb 20 00 00       	call   21a0 <bigfile>
  subdir();
      a5:	e8 66 19 00 00       	call   1a10 <subdir>
  concreate();
      aa:	e8 61 15 00 00       	call   1610 <concreate>
      af:	90                   	nop
  linktest();
      b0:	e8 fb 12 00 00       	call   13b0 <linktest>
  unlinkread();
      b5:	e8 26 11 00 00       	call   11e0 <unlinkread>
  createdelete();
      ba:	e8 c1 0e 00 00       	call   f80 <createdelete>
      bf:	90                   	nop
  twofiles();
      c0:	e8 9b 0c 00 00       	call   d60 <twofiles>
  sharedfd();
      c5:	e8 d6 0a 00 00       	call   ba0 <sharedfd>
  dirfile();
      ca:	e8 b1 25 00 00       	call   2680 <dirfile>
      cf:	90                   	nop
  iref();
      d0:	e8 db 27 00 00       	call   28b0 <iref>
  forktest();
      d5:	e8 f6 28 00 00       	call   29d0 <forktest>
  bigdir(); // slow
      da:	e8 f1 17 00 00       	call   18d0 <bigdir>
      df:	90                   	nop

  exectest();
      e0:	e8 2b 06 00 00       	call   710 <exectest>

  exit();
      e5:	e8 1a 2c 00 00       	call   2d04 <exit>
      ea:	90                   	nop
      eb:	90                   	nop
      ec:	90                   	nop
      ed:	90                   	nop
      ee:	90                   	nop
      ef:	90                   	nop

000000f0 <opentest>:

// simple file system tests

void
opentest(void)
{
      f0:	83 ec 1c             	sub    $0x1c,%esp
  int fd;

  printf(stdout, "open test\n");
      f3:	a1 98 4a 00 00       	mov    0x4a98,%eax
      f8:	c7 44 24 04 18 31 00 	movl   $0x3118,0x4(%esp)
      ff:	00 
     100:	89 04 24             	mov    %eax,(%esp)
     103:	e8 48 2d 00 00       	call   2e50 <printf>
  fd = open("echo", 0);
     108:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
     10f:	00 
     110:	c7 04 24 23 31 00 00 	movl   $0x3123,(%esp)
     117:	e8 28 2c 00 00       	call   2d44 <open>
  if(fd < 0){
     11c:	85 c0                	test   %eax,%eax
     11e:	78 39                	js     159 <opentest+0x69>
    printf(stdout, "open echo failed!\n");
    exit();
  }
  close(fd);
     120:	89 04 24             	mov    %eax,(%esp)
     123:	e8 04 2c 00 00       	call   2d2c <close>
  fd = open("doesnotexist", 0);
     128:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
     12f:	00 
     130:	c7 04 24 3b 31 00 00 	movl   $0x313b,(%esp)
     137:	e8 08 2c 00 00       	call   2d44 <open>
  if(fd >= 0){
     13c:	85 c0                	test   %eax,%eax
     13e:	79 33                	jns    173 <opentest+0x83>
    printf(stdout, "open doesnotexist succeeded!\n");
    exit();
  }
  printf(stdout, "open test ok\n");
     140:	a1 98 4a 00 00       	mov    0x4a98,%eax
     145:	c7 44 24 04 66 31 00 	movl   $0x3166,0x4(%esp)
     14c:	00 
     14d:	89 04 24             	mov    %eax,(%esp)
     150:	e8 fb 2c 00 00       	call   2e50 <printf>
}
     155:	83 c4 1c             	add    $0x1c,%esp
     158:	c3                   	ret    
  int fd;

  printf(stdout, "open test\n");
  fd = open("echo", 0);
  if(fd < 0){
    printf(stdout, "open echo failed!\n");
     159:	a1 98 4a 00 00       	mov    0x4a98,%eax
     15e:	c7 44 24 04 28 31 00 	movl   $0x3128,0x4(%esp)
     165:	00 
     166:	89 04 24             	mov    %eax,(%esp)
     169:	e8 e2 2c 00 00       	call   2e50 <printf>
    exit();
     16e:	e8 91 2b 00 00       	call   2d04 <exit>
  }
  close(fd);
  fd = open("doesnotexist", 0);
  if(fd >= 0){
    printf(stdout, "open doesnotexist succeeded!\n");
     173:	a1 98 4a 00 00       	mov    0x4a98,%eax
     178:	c7 44 24 04 48 31 00 	movl   $0x3148,0x4(%esp)
     17f:	00 
     180:	89 04 24             	mov    %eax,(%esp)
     183:	e8 c8 2c 00 00       	call   2e50 <printf>
    exit();
     188:	e8 77 2b 00 00       	call   2d04 <exit>
     18d:	8d 76 00             	lea    0x0(%esi),%esi

00000190 <writetest>:
  printf(stdout, "open test ok\n");
}

void
writetest(void)
{
     190:	56                   	push   %esi
     191:	53                   	push   %ebx
     192:	83 ec 14             	sub    $0x14,%esp
  int fd;
  int i;

  printf(stdout, "small file test\n");
     195:	a1 98 4a 00 00       	mov    0x4a98,%eax
     19a:	c7 44 24 04 74 31 00 	movl   $0x3174,0x4(%esp)
     1a1:	00 
     1a2:	89 04 24             	mov    %eax,(%esp)
     1a5:	e8 a6 2c 00 00       	call   2e50 <printf>
  fd = open("small", O_CREATE|O_RDWR);
     1aa:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
     1b1:	00 
     1b2:	c7 04 24 85 31 00 00 	movl   $0x3185,(%esp)
     1b9:	e8 86 2b 00 00       	call   2d44 <open>
  if(fd >= 0){
     1be:	85 c0                	test   %eax,%eax
{
  int fd;
  int i;

  printf(stdout, "small file test\n");
  fd = open("small", O_CREATE|O_RDWR);
     1c0:	89 c6                	mov    %eax,%esi
  if(fd >= 0){
     1c2:	0f 88 ab 01 00 00    	js     373 <writetest+0x1e3>
    printf(stdout, "creat small succeeded; ok\n");
     1c8:	a1 98 4a 00 00       	mov    0x4a98,%eax
  } else {
    printf(stdout, "error: creat small failed!\n");
    exit();
  }
  for(i = 0; i < 100; i++) {
     1cd:	31 db                	xor    %ebx,%ebx
  int i;

  printf(stdout, "small file test\n");
  fd = open("small", O_CREATE|O_RDWR);
  if(fd >= 0){
    printf(stdout, "creat small succeeded; ok\n");
     1cf:	c7 44 24 04 8b 31 00 	movl   $0x318b,0x4(%esp)
     1d6:	00 
     1d7:	89 04 24             	mov    %eax,(%esp)
     1da:	e8 71 2c 00 00       	call   2e50 <printf>
     1df:	90                   	nop
  } else {
    printf(stdout, "error: creat small failed!\n");
    exit();
  }
  for(i = 0; i < 100; i++) {
    if(write(fd, "aaaaaaaaaa", 10) != 10) {
     1e0:	c7 44 24 08 0a 00 00 	movl   $0xa,0x8(%esp)
     1e7:	00 
     1e8:	c7 44 24 04 c2 31 00 	movl   $0x31c2,0x4(%esp)
     1ef:	00 
     1f0:	89 34 24             	mov    %esi,(%esp)
     1f3:	e8 2c 2b 00 00       	call   2d24 <write>
     1f8:	83 f8 0a             	cmp    $0xa,%eax
     1fb:	0f 85 e8 00 00 00    	jne    2e9 <writetest+0x159>
      printf(stdout, "error: write aa %d new file failed\n", i);
      exit();
    }
    if(write(fd, "bbbbbbbbbb", 10) != 10) {
     201:	c7 44 24 08 0a 00 00 	movl   $0xa,0x8(%esp)
     208:	00 
     209:	c7 44 24 04 cd 31 00 	movl   $0x31cd,0x4(%esp)
     210:	00 
     211:	89 34 24             	mov    %esi,(%esp)
     214:	e8 0b 2b 00 00       	call   2d24 <write>
     219:	83 f8 0a             	cmp    $0xa,%eax
     21c:	0f 85 e5 00 00 00    	jne    307 <writetest+0x177>
    printf(stdout, "creat small succeeded; ok\n");
  } else {
    printf(stdout, "error: creat small failed!\n");
    exit();
  }
  for(i = 0; i < 100; i++) {
     222:	83 c3 01             	add    $0x1,%ebx
     225:	83 fb 64             	cmp    $0x64,%ebx
     228:	75 b6                	jne    1e0 <writetest+0x50>
    if(write(fd, "bbbbbbbbbb", 10) != 10) {
      printf(stdout, "error: write bb %d new file failed\n", i);
      exit();
    }
  }
  printf(stdout, "writes ok\n");
     22a:	a1 98 4a 00 00       	mov    0x4a98,%eax
     22f:	c7 44 24 04 d8 31 00 	movl   $0x31d8,0x4(%esp)
     236:	00 
     237:	89 04 24             	mov    %eax,(%esp)
     23a:	e8 11 2c 00 00       	call   2e50 <printf>
  close(fd);
     23f:	89 34 24             	mov    %esi,(%esp)
     242:	e8 e5 2a 00 00       	call   2d2c <close>
  fd = open("small", O_RDONLY);
     247:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
     24e:	00 
     24f:	c7 04 24 85 31 00 00 	movl   $0x3185,(%esp)
     256:	e8 e9 2a 00 00       	call   2d44 <open>
  if(fd >= 0){
     25b:	85 c0                	test   %eax,%eax
      exit();
    }
  }
  printf(stdout, "writes ok\n");
  close(fd);
  fd = open("small", O_RDONLY);
     25d:	89 c3                	mov    %eax,%ebx
  if(fd >= 0){
     25f:	0f 88 c0 00 00 00    	js     325 <writetest+0x195>
    printf(stdout, "open small succeeded ok\n");
     265:	a1 98 4a 00 00       	mov    0x4a98,%eax
     26a:	c7 44 24 04 e3 31 00 	movl   $0x31e3,0x4(%esp)
     271:	00 
     272:	89 04 24             	mov    %eax,(%esp)
     275:	e8 d6 2b 00 00       	call   2e50 <printf>
  } else {
    printf(stdout, "error: open small failed!\n");
    exit();
  }
  i = read(fd, buf, 2000);
     27a:	c7 44 24 08 d0 07 00 	movl   $0x7d0,0x8(%esp)
     281:	00 
     282:	c7 44 24 04 e0 4a 00 	movl   $0x4ae0,0x4(%esp)
     289:	00 
     28a:	89 1c 24             	mov    %ebx,(%esp)
     28d:	e8 8a 2a 00 00       	call   2d1c <read>
  if(i == 2000) {
     292:	3d d0 07 00 00       	cmp    $0x7d0,%eax
     297:	0f 85 a2 00 00 00    	jne    33f <writetest+0x1af>
    printf(stdout, "read succeeded ok\n");
     29d:	a1 98 4a 00 00       	mov    0x4a98,%eax
     2a2:	c7 44 24 04 17 32 00 	movl   $0x3217,0x4(%esp)
     2a9:	00 
     2aa:	89 04 24             	mov    %eax,(%esp)
     2ad:	e8 9e 2b 00 00       	call   2e50 <printf>
  } else {
    printf(stdout, "read failed\n");
    exit();
  }
  close(fd);
     2b2:	89 1c 24             	mov    %ebx,(%esp)
     2b5:	e8 72 2a 00 00       	call   2d2c <close>

  if(unlink("small") < 0) {
     2ba:	c7 04 24 85 31 00 00 	movl   $0x3185,(%esp)
     2c1:	e8 8e 2a 00 00       	call   2d54 <unlink>
     2c6:	85 c0                	test   %eax,%eax
     2c8:	0f 88 8b 00 00 00    	js     359 <writetest+0x1c9>
    printf(stdout, "unlink small failed\n");
    exit();
  }
  printf(stdout, "small file test ok\n");
     2ce:	a1 98 4a 00 00       	mov    0x4a98,%eax
     2d3:	c7 44 24 04 3f 32 00 	movl   $0x323f,0x4(%esp)
     2da:	00 
     2db:	89 04 24             	mov    %eax,(%esp)
     2de:	e8 6d 2b 00 00       	call   2e50 <printf>
}
     2e3:	83 c4 14             	add    $0x14,%esp
     2e6:	5b                   	pop    %ebx
     2e7:	5e                   	pop    %esi
     2e8:	c3                   	ret    
    printf(stdout, "error: creat small failed!\n");
    exit();
  }
  for(i = 0; i < 100; i++) {
    if(write(fd, "aaaaaaaaaa", 10) != 10) {
      printf(stdout, "error: write aa %d new file failed\n", i);
     2e9:	a1 98 4a 00 00       	mov    0x4a98,%eax
     2ee:	89 5c 24 08          	mov    %ebx,0x8(%esp)
     2f2:	c7 44 24 04 fc 3d 00 	movl   $0x3dfc,0x4(%esp)
     2f9:	00 
     2fa:	89 04 24             	mov    %eax,(%esp)
     2fd:	e8 4e 2b 00 00       	call   2e50 <printf>
      exit();
     302:	e8 fd 29 00 00       	call   2d04 <exit>
    }
    if(write(fd, "bbbbbbbbbb", 10) != 10) {
      printf(stdout, "error: write bb %d new file failed\n", i);
     307:	a1 98 4a 00 00       	mov    0x4a98,%eax
     30c:	89 5c 24 08          	mov    %ebx,0x8(%esp)
     310:	c7 44 24 04 20 3e 00 	movl   $0x3e20,0x4(%esp)
     317:	00 
     318:	89 04 24             	mov    %eax,(%esp)
     31b:	e8 30 2b 00 00       	call   2e50 <printf>
      exit();
     320:	e8 df 29 00 00       	call   2d04 <exit>
  close(fd);
  fd = open("small", O_RDONLY);
  if(fd >= 0){
    printf(stdout, "open small succeeded ok\n");
  } else {
    printf(stdout, "error: open small failed!\n");
     325:	a1 98 4a 00 00       	mov    0x4a98,%eax
     32a:	c7 44 24 04 fc 31 00 	movl   $0x31fc,0x4(%esp)
     331:	00 
     332:	89 04 24             	mov    %eax,(%esp)
     335:	e8 16 2b 00 00       	call   2e50 <printf>
    exit();
     33a:	e8 c5 29 00 00       	call   2d04 <exit>
  }
  i = read(fd, buf, 2000);
  if(i == 2000) {
    printf(stdout, "read succeeded ok\n");
  } else {
    printf(stdout, "read failed\n");
     33f:	a1 98 4a 00 00       	mov    0x4a98,%eax
     344:	c7 44 24 04 3d 35 00 	movl   $0x353d,0x4(%esp)
     34b:	00 
     34c:	89 04 24             	mov    %eax,(%esp)
     34f:	e8 fc 2a 00 00       	call   2e50 <printf>
    exit();
     354:	e8 ab 29 00 00       	call   2d04 <exit>
  }
  close(fd);

  if(unlink("small") < 0) {
    printf(stdout, "unlink small failed\n");
     359:	a1 98 4a 00 00       	mov    0x4a98,%eax
     35e:	c7 44 24 04 2a 32 00 	movl   $0x322a,0x4(%esp)
     365:	00 
     366:	89 04 24             	mov    %eax,(%esp)
     369:	e8 e2 2a 00 00       	call   2e50 <printf>
    exit();
     36e:	e8 91 29 00 00       	call   2d04 <exit>
  printf(stdout, "small file test\n");
  fd = open("small", O_CREATE|O_RDWR);
  if(fd >= 0){
    printf(stdout, "creat small succeeded; ok\n");
  } else {
    printf(stdout, "error: creat small failed!\n");
     373:	a1 98 4a 00 00       	mov    0x4a98,%eax
     378:	c7 44 24 04 a6 31 00 	movl   $0x31a6,0x4(%esp)
     37f:	00 
     380:	89 04 24             	mov    %eax,(%esp)
     383:	e8 c8 2a 00 00       	call   2e50 <printf>
    exit();
     388:	e8 77 29 00 00       	call   2d04 <exit>
     38d:	8d 76 00             	lea    0x0(%esi),%esi

00000390 <writetest1>:
  printf(stdout, "small file test ok\n");
}

void
writetest1(void)
{
     390:	56                   	push   %esi
     391:	53                   	push   %ebx
     392:	83 ec 14             	sub    $0x14,%esp
  int i, fd, n;

  printf(stdout, "big files test\n");
     395:	a1 98 4a 00 00       	mov    0x4a98,%eax
     39a:	c7 44 24 04 53 32 00 	movl   $0x3253,0x4(%esp)
     3a1:	00 
     3a2:	89 04 24             	mov    %eax,(%esp)
     3a5:	e8 a6 2a 00 00       	call   2e50 <printf>

  fd = open("big", O_CREATE|O_RDWR);
     3aa:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
     3b1:	00 
     3b2:	c7 04 24 cd 32 00 00 	movl   $0x32cd,(%esp)
     3b9:	e8 86 29 00 00       	call   2d44 <open>
  if(fd < 0){
     3be:	85 c0                	test   %eax,%eax
{
  int i, fd, n;

  printf(stdout, "big files test\n");

  fd = open("big", O_CREATE|O_RDWR);
     3c0:	89 c6                	mov    %eax,%esi
  if(fd < 0){
     3c2:	0f 88 7c 01 00 00    	js     544 <writetest1+0x1b4>
     3c8:	31 db                	xor    %ebx,%ebx
     3ca:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    printf(stdout, "error: creat big failed!\n");
    exit();
  }

  for(i = 0; i < MAXFILE; i++) {
    ((int*) buf)[0] = i;
     3d0:	89 1d e0 4a 00 00    	mov    %ebx,0x4ae0
    if(write(fd, buf, 512) != 512) {
     3d6:	c7 44 24 08 00 02 00 	movl   $0x200,0x8(%esp)
     3dd:	00 
     3de:	c7 44 24 04 e0 4a 00 	movl   $0x4ae0,0x4(%esp)
     3e5:	00 
     3e6:	89 34 24             	mov    %esi,(%esp)
     3e9:	e8 36 29 00 00       	call   2d24 <write>
     3ee:	3d 00 02 00 00       	cmp    $0x200,%eax
     3f3:	0f 85 b1 00 00 00    	jne    4aa <writetest1+0x11a>
  if(fd < 0){
    printf(stdout, "error: creat big failed!\n");
    exit();
  }

  for(i = 0; i < MAXFILE; i++) {
     3f9:	83 c3 01             	add    $0x1,%ebx
     3fc:	81 fb 8c 00 00 00    	cmp    $0x8c,%ebx
     402:	75 cc                	jne    3d0 <writetest1+0x40>
      printf(stdout, "error: write big file failed\n", i);
      exit();
    }
  }

  close(fd);
     404:	89 34 24             	mov    %esi,(%esp)
     407:	e8 20 29 00 00       	call   2d2c <close>

  fd = open("big", O_RDONLY);
     40c:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
     413:	00 
     414:	c7 04 24 cd 32 00 00 	movl   $0x32cd,(%esp)
     41b:	e8 24 29 00 00       	call   2d44 <open>
  if(fd < 0){
     420:	85 c0                	test   %eax,%eax
    }
  }

  close(fd);

  fd = open("big", O_RDONLY);
     422:	89 c6                	mov    %eax,%esi
  if(fd < 0){
     424:	0f 88 00 01 00 00    	js     52a <writetest1+0x19a>
     42a:	31 db                	xor    %ebx,%ebx
     42c:	eb 1d                	jmp    44b <writetest1+0xbb>
     42e:	66 90                	xchg   %ax,%ax
      if(n == MAXFILE - 1) {
        printf(stdout, "read only %d blocks from big", n);
        exit();
      }
      break;
    } else if(i != 512) {
     430:	3d 00 02 00 00       	cmp    $0x200,%eax
     435:	0f 85 af 00 00 00    	jne    4ea <writetest1+0x15a>
      printf(stdout, "read failed %d\n", i);
      exit();
    }
    if(((int*)buf)[0] != n) {
     43b:	a1 e0 4a 00 00       	mov    0x4ae0,%eax
     440:	39 d8                	cmp    %ebx,%eax
     442:	0f 85 80 00 00 00    	jne    4c8 <writetest1+0x138>
      printf(stdout, "read content of block %d is %d\n",
             n, ((int*)buf)[0]);
      exit();
    }
    n++;
     448:	83 c3 01             	add    $0x1,%ebx
    exit();
  }

  n = 0;
  for(;;) {
    i = read(fd, buf, 512);
     44b:	c7 44 24 08 00 02 00 	movl   $0x200,0x8(%esp)
     452:	00 
     453:	c7 44 24 04 e0 4a 00 	movl   $0x4ae0,0x4(%esp)
     45a:	00 
     45b:	89 34 24             	mov    %esi,(%esp)
     45e:	e8 b9 28 00 00       	call   2d1c <read>
    if(i == 0) {
     463:	85 c0                	test   %eax,%eax
     465:	75 c9                	jne    430 <writetest1+0xa0>
      if(n == MAXFILE - 1) {
     467:	81 fb 8b 00 00 00    	cmp    $0x8b,%ebx
     46d:	0f 84 95 00 00 00    	je     508 <writetest1+0x178>
             n, ((int*)buf)[0]);
      exit();
    }
    n++;
  }
  close(fd);
     473:	89 34 24             	mov    %esi,(%esp)
     476:	e8 b1 28 00 00       	call   2d2c <close>
  if(unlink("big") < 0) {
     47b:	c7 04 24 cd 32 00 00 	movl   $0x32cd,(%esp)
     482:	e8 cd 28 00 00       	call   2d54 <unlink>
     487:	85 c0                	test   %eax,%eax
     489:	0f 88 cf 00 00 00    	js     55e <writetest1+0x1ce>
    printf(stdout, "unlink big failed\n");
    exit();
  }
  printf(stdout, "big files ok\n");
     48f:	a1 98 4a 00 00       	mov    0x4a98,%eax
     494:	c7 44 24 04 f4 32 00 	movl   $0x32f4,0x4(%esp)
     49b:	00 
     49c:	89 04 24             	mov    %eax,(%esp)
     49f:	e8 ac 29 00 00       	call   2e50 <printf>
}
     4a4:	83 c4 14             	add    $0x14,%esp
     4a7:	5b                   	pop    %ebx
     4a8:	5e                   	pop    %esi
     4a9:	c3                   	ret    
  }

  for(i = 0; i < MAXFILE; i++) {
    ((int*) buf)[0] = i;
    if(write(fd, buf, 512) != 512) {
      printf(stdout, "error: write big file failed\n", i);
     4aa:	a1 98 4a 00 00       	mov    0x4a98,%eax
     4af:	89 5c 24 08          	mov    %ebx,0x8(%esp)
     4b3:	c7 44 24 04 7d 32 00 	movl   $0x327d,0x4(%esp)
     4ba:	00 
     4bb:	89 04 24             	mov    %eax,(%esp)
     4be:	e8 8d 29 00 00       	call   2e50 <printf>
      exit();
     4c3:	e8 3c 28 00 00       	call   2d04 <exit>
    } else if(i != 512) {
      printf(stdout, "read failed %d\n", i);
      exit();
    }
    if(((int*)buf)[0] != n) {
      printf(stdout, "read content of block %d is %d\n",
     4c8:	89 44 24 0c          	mov    %eax,0xc(%esp)
     4cc:	a1 98 4a 00 00       	mov    0x4a98,%eax
     4d1:	89 5c 24 08          	mov    %ebx,0x8(%esp)
     4d5:	c7 44 24 04 44 3e 00 	movl   $0x3e44,0x4(%esp)
     4dc:	00 
     4dd:	89 04 24             	mov    %eax,(%esp)
     4e0:	e8 6b 29 00 00       	call   2e50 <printf>
             n, ((int*)buf)[0]);
      exit();
     4e5:	e8 1a 28 00 00       	call   2d04 <exit>
        printf(stdout, "read only %d blocks from big", n);
        exit();
      }
      break;
    } else if(i != 512) {
      printf(stdout, "read failed %d\n", i);
     4ea:	89 44 24 08          	mov    %eax,0x8(%esp)
     4ee:	a1 98 4a 00 00       	mov    0x4a98,%eax
     4f3:	c7 44 24 04 d1 32 00 	movl   $0x32d1,0x4(%esp)
     4fa:	00 
     4fb:	89 04 24             	mov    %eax,(%esp)
     4fe:	e8 4d 29 00 00       	call   2e50 <printf>
      exit();
     503:	e8 fc 27 00 00       	call   2d04 <exit>
  n = 0;
  for(;;) {
    i = read(fd, buf, 512);
    if(i == 0) {
      if(n == MAXFILE - 1) {
        printf(stdout, "read only %d blocks from big", n);
     508:	a1 98 4a 00 00       	mov    0x4a98,%eax
     50d:	c7 44 24 08 8b 00 00 	movl   $0x8b,0x8(%esp)
     514:	00 
     515:	c7 44 24 04 b4 32 00 	movl   $0x32b4,0x4(%esp)
     51c:	00 
     51d:	89 04 24             	mov    %eax,(%esp)
     520:	e8 2b 29 00 00       	call   2e50 <printf>
        exit();
     525:	e8 da 27 00 00       	call   2d04 <exit>

  close(fd);

  fd = open("big", O_RDONLY);
  if(fd < 0){
    printf(stdout, "error: open big failed!\n");
     52a:	a1 98 4a 00 00       	mov    0x4a98,%eax
     52f:	c7 44 24 04 9b 32 00 	movl   $0x329b,0x4(%esp)
     536:	00 
     537:	89 04 24             	mov    %eax,(%esp)
     53a:	e8 11 29 00 00       	call   2e50 <printf>
    exit();
     53f:	e8 c0 27 00 00       	call   2d04 <exit>

  printf(stdout, "big files test\n");

  fd = open("big", O_CREATE|O_RDWR);
  if(fd < 0){
    printf(stdout, "error: creat big failed!\n");
     544:	a1 98 4a 00 00       	mov    0x4a98,%eax
     549:	c7 44 24 04 63 32 00 	movl   $0x3263,0x4(%esp)
     550:	00 
     551:	89 04 24             	mov    %eax,(%esp)
     554:	e8 f7 28 00 00       	call   2e50 <printf>
    exit();
     559:	e8 a6 27 00 00       	call   2d04 <exit>
    }
    n++;
  }
  close(fd);
  if(unlink("big") < 0) {
    printf(stdout, "unlink big failed\n");
     55e:	a1 98 4a 00 00       	mov    0x4a98,%eax
     563:	c7 44 24 04 e1 32 00 	movl   $0x32e1,0x4(%esp)
     56a:	00 
     56b:	89 04 24             	mov    %eax,(%esp)
     56e:	e8 dd 28 00 00       	call   2e50 <printf>
    exit();
     573:	e8 8c 27 00 00       	call   2d04 <exit>
     578:	90                   	nop
     579:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00000580 <createtest>:
  printf(stdout, "big files ok\n");
}

void
createtest(void)
{
     580:	53                   	push   %ebx
  int i, fd;

  printf(stdout, "many creates, followed by unlink test\n");

  name[0] = 'a';
  name[2] = '\0';
     581:	bb 30 00 00 00       	mov    $0x30,%ebx
  printf(stdout, "big files ok\n");
}

void
createtest(void)
{
     586:	83 ec 18             	sub    $0x18,%esp
  int i, fd;

  printf(stdout, "many creates, followed by unlink test\n");
     589:	a1 98 4a 00 00       	mov    0x4a98,%eax
     58e:	c7 44 24 04 64 3e 00 	movl   $0x3e64,0x4(%esp)
     595:	00 
     596:	89 04 24             	mov    %eax,(%esp)
     599:	e8 b2 28 00 00       	call   2e50 <printf>

  name[0] = 'a';
     59e:	c6 05 e0 52 00 00 61 	movb   $0x61,0x52e0
  name[2] = '\0';
     5a5:	c6 05 e2 52 00 00 00 	movb   $0x0,0x52e2
     5ac:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  for(i = 0; i < 52; i++) {
    name[1] = '0' + i;
     5b0:	88 1d e1 52 00 00    	mov    %bl,0x52e1
    fd = open(name, O_CREATE|O_RDWR);
    close(fd);
     5b6:	83 c3 01             	add    $0x1,%ebx

  name[0] = 'a';
  name[2] = '\0';
  for(i = 0; i < 52; i++) {
    name[1] = '0' + i;
    fd = open(name, O_CREATE|O_RDWR);
     5b9:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
     5c0:	00 
     5c1:	c7 04 24 e0 52 00 00 	movl   $0x52e0,(%esp)
     5c8:	e8 77 27 00 00       	call   2d44 <open>
    close(fd);
     5cd:	89 04 24             	mov    %eax,(%esp)
     5d0:	e8 57 27 00 00       	call   2d2c <close>

  printf(stdout, "many creates, followed by unlink test\n");

  name[0] = 'a';
  name[2] = '\0';
  for(i = 0; i < 52; i++) {
     5d5:	80 fb 64             	cmp    $0x64,%bl
     5d8:	75 d6                	jne    5b0 <createtest+0x30>
    name[1] = '0' + i;
    fd = open(name, O_CREATE|O_RDWR);
    close(fd);
  }
  name[0] = 'a';
     5da:	c6 05 e0 52 00 00 61 	movb   $0x61,0x52e0
  name[2] = '\0';
     5e1:	bb 30 00 00 00       	mov    $0x30,%ebx
     5e6:	c6 05 e2 52 00 00 00 	movb   $0x0,0x52e2
     5ed:	8d 76 00             	lea    0x0(%esi),%esi
  for(i = 0; i < 52; i++) {
    name[1] = '0' + i;
     5f0:	88 1d e1 52 00 00    	mov    %bl,0x52e1
    unlink(name);
     5f6:	83 c3 01             	add    $0x1,%ebx
     5f9:	c7 04 24 e0 52 00 00 	movl   $0x52e0,(%esp)
     600:	e8 4f 27 00 00       	call   2d54 <unlink>
    fd = open(name, O_CREATE|O_RDWR);
    close(fd);
  }
  name[0] = 'a';
  name[2] = '\0';
  for(i = 0; i < 52; i++) {
     605:	80 fb 64             	cmp    $0x64,%bl
     608:	75 e6                	jne    5f0 <createtest+0x70>
    name[1] = '0' + i;
    unlink(name);
  }
  printf(stdout, "many creates, followed by unlink; ok\n");
     60a:	a1 98 4a 00 00       	mov    0x4a98,%eax
     60f:	c7 44 24 04 8c 3e 00 	movl   $0x3e8c,0x4(%esp)
     616:	00 
     617:	89 04 24             	mov    %eax,(%esp)
     61a:	e8 31 28 00 00       	call   2e50 <printf>
}
     61f:	83 c4 18             	add    $0x18,%esp
     622:	5b                   	pop    %ebx
     623:	c3                   	ret    
     624:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
     62a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00000630 <dirtest>:

void dirtest(void)
{
     630:	83 ec 1c             	sub    $0x1c,%esp
  printf(stdout, "mkdir test\n");
     633:	a1 98 4a 00 00       	mov    0x4a98,%eax
     638:	c7 44 24 04 02 33 00 	movl   $0x3302,0x4(%esp)
     63f:	00 
     640:	89 04 24             	mov    %eax,(%esp)
     643:	e8 08 28 00 00       	call   2e50 <printf>

  if(mkdir("dir0") < 0) {
     648:	c7 04 24 0e 33 00 00 	movl   $0x330e,(%esp)
     64f:	e8 18 27 00 00       	call   2d6c <mkdir>
     654:	85 c0                	test   %eax,%eax
     656:	78 4d                	js     6a5 <dirtest+0x75>
    printf(stdout, "mkdir failed\n");
    exit();
  }

  if(chdir("dir0") < 0) {
     658:	c7 04 24 0e 33 00 00 	movl   $0x330e,(%esp)
     65f:	e8 10 27 00 00       	call   2d74 <chdir>
     664:	85 c0                	test   %eax,%eax
     666:	0f 88 87 00 00 00    	js     6f3 <dirtest+0xc3>
    printf(stdout, "chdir dir0 failed\n");
    exit();
  }

  if(chdir("..") < 0) {
     66c:	c7 04 24 89 38 00 00 	movl   $0x3889,(%esp)
     673:	e8 fc 26 00 00       	call   2d74 <chdir>
     678:	85 c0                	test   %eax,%eax
     67a:	78 5d                	js     6d9 <dirtest+0xa9>
    printf(stdout, "chdir .. failed\n");
    exit();
  }

  if(unlink("dir0") < 0) {
     67c:	c7 04 24 0e 33 00 00 	movl   $0x330e,(%esp)
     683:	e8 cc 26 00 00       	call   2d54 <unlink>
     688:	85 c0                	test   %eax,%eax
     68a:	78 33                	js     6bf <dirtest+0x8f>
    printf(stdout, "unlink dir0 failed\n");
    exit();
  }
  printf(stdout, "mkdir test\n");
     68c:	a1 98 4a 00 00       	mov    0x4a98,%eax
     691:	c7 44 24 04 02 33 00 	movl   $0x3302,0x4(%esp)
     698:	00 
     699:	89 04 24             	mov    %eax,(%esp)
     69c:	e8 af 27 00 00       	call   2e50 <printf>
}
     6a1:	83 c4 1c             	add    $0x1c,%esp
     6a4:	c3                   	ret    
void dirtest(void)
{
  printf(stdout, "mkdir test\n");

  if(mkdir("dir0") < 0) {
    printf(stdout, "mkdir failed\n");
     6a5:	a1 98 4a 00 00       	mov    0x4a98,%eax
     6aa:	c7 44 24 04 13 33 00 	movl   $0x3313,0x4(%esp)
     6b1:	00 
     6b2:	89 04 24             	mov    %eax,(%esp)
     6b5:	e8 96 27 00 00       	call   2e50 <printf>
    exit();
     6ba:	e8 45 26 00 00       	call   2d04 <exit>
    printf(stdout, "chdir .. failed\n");
    exit();
  }

  if(unlink("dir0") < 0) {
    printf(stdout, "unlink dir0 failed\n");
     6bf:	a1 98 4a 00 00       	mov    0x4a98,%eax
     6c4:	c7 44 24 04 45 33 00 	movl   $0x3345,0x4(%esp)
     6cb:	00 
     6cc:	89 04 24             	mov    %eax,(%esp)
     6cf:	e8 7c 27 00 00       	call   2e50 <printf>
    exit();
     6d4:	e8 2b 26 00 00       	call   2d04 <exit>
    printf(stdout, "chdir dir0 failed\n");
    exit();
  }

  if(chdir("..") < 0) {
    printf(stdout, "chdir .. failed\n");
     6d9:	a1 98 4a 00 00       	mov    0x4a98,%eax
     6de:	c7 44 24 04 34 33 00 	movl   $0x3334,0x4(%esp)
     6e5:	00 
     6e6:	89 04 24             	mov    %eax,(%esp)
     6e9:	e8 62 27 00 00       	call   2e50 <printf>
    exit();
     6ee:	e8 11 26 00 00       	call   2d04 <exit>
    printf(stdout, "mkdir failed\n");
    exit();
  }

  if(chdir("dir0") < 0) {
    printf(stdout, "chdir dir0 failed\n");
     6f3:	a1 98 4a 00 00       	mov    0x4a98,%eax
     6f8:	c7 44 24 04 21 33 00 	movl   $0x3321,0x4(%esp)
     6ff:	00 
     700:	89 04 24             	mov    %eax,(%esp)
     703:	e8 48 27 00 00       	call   2e50 <printf>
    exit();
     708:	e8 f7 25 00 00       	call   2d04 <exit>
     70d:	8d 76 00             	lea    0x0(%esi),%esi

00000710 <exectest>:
  printf(stdout, "mkdir test\n");
}

void
exectest(void)
{
     710:	83 ec 1c             	sub    $0x1c,%esp
  printf(stdout, "exec test\n");
     713:	a1 98 4a 00 00       	mov    0x4a98,%eax
     718:	c7 44 24 04 59 33 00 	movl   $0x3359,0x4(%esp)
     71f:	00 
     720:	89 04 24             	mov    %eax,(%esp)
     723:	e8 28 27 00 00       	call   2e50 <printf>
  if(exec("echo", echoargv) < 0) {
     728:	c7 44 24 04 9c 4a 00 	movl   $0x4a9c,0x4(%esp)
     72f:	00 
     730:	c7 04 24 23 31 00 00 	movl   $0x3123,(%esp)
     737:	e8 00 26 00 00       	call   2d3c <exec>
     73c:	85 c0                	test   %eax,%eax
     73e:	78 04                	js     744 <exectest+0x34>
    printf(stdout, "exec echo failed\n");
    exit();
  }
}
     740:	83 c4 1c             	add    $0x1c,%esp
     743:	c3                   	ret    
void
exectest(void)
{
  printf(stdout, "exec test\n");
  if(exec("echo", echoargv) < 0) {
    printf(stdout, "exec echo failed\n");
     744:	a1 98 4a 00 00       	mov    0x4a98,%eax
     749:	c7 44 24 04 64 33 00 	movl   $0x3364,0x4(%esp)
     750:	00 
     751:	89 04 24             	mov    %eax,(%esp)
     754:	e8 f7 26 00 00       	call   2e50 <printf>
    exit();
     759:	e8 a6 25 00 00       	call   2d04 <exit>
     75e:	66 90                	xchg   %ax,%ax

00000760 <pipe1>:

// simple fork and pipe read/write

void
pipe1(void)
{
     760:	57                   	push   %edi
     761:	56                   	push   %esi
     762:	53                   	push   %ebx
     763:	83 ec 20             	sub    $0x20,%esp
  int fds[2], pid;
  int seq, i, n, cc, total;

  if(pipe(fds) != 0){
     766:	8d 44 24 18          	lea    0x18(%esp),%eax
     76a:	89 04 24             	mov    %eax,(%esp)
     76d:	e8 a2 25 00 00       	call   2d14 <pipe>
     772:	85 c0                	test   %eax,%eax
     774:	0f 85 51 01 00 00    	jne    8cb <pipe1+0x16b>
    printf(1, "pipe() failed\n");
    exit();
  }
  pid = fork();
     77a:	e8 7d 25 00 00       	call   2cfc <fork>
  seq = 0;
  if(pid == 0){
     77f:	83 f8 00             	cmp    $0x0,%eax
     782:	0f 84 86 00 00 00    	je     80e <pipe1+0xae>
        printf(1, "pipe1 oops 1\n");
        exit();
      }
    }
    exit();
  } else if(pid > 0){
     788:	0f 8e 56 01 00 00    	jle    8e4 <pipe1+0x184>
    close(fds[1]);
     78e:	8b 44 24 1c          	mov    0x1c(%esp),%eax
    total = 0;
     792:	31 ff                	xor    %edi,%edi
    cc = 1;
     794:	be 01 00 00 00       	mov    $0x1,%esi
  if(pipe(fds) != 0){
    printf(1, "pipe() failed\n");
    exit();
  }
  pid = fork();
  seq = 0;
     799:	31 db                	xor    %ebx,%ebx
        exit();
      }
    }
    exit();
  } else if(pid > 0){
    close(fds[1]);
     79b:	89 04 24             	mov    %eax,(%esp)
     79e:	e8 89 25 00 00       	call   2d2c <close>
    total = 0;
    cc = 1;
    while((n = read(fds[0], buf, cc)) > 0){
     7a3:	8b 44 24 18          	mov    0x18(%esp),%eax
     7a7:	89 74 24 08          	mov    %esi,0x8(%esp)
     7ab:	c7 44 24 04 e0 4a 00 	movl   $0x4ae0,0x4(%esp)
     7b2:	00 
     7b3:	89 04 24             	mov    %eax,(%esp)
     7b6:	e8 61 25 00 00       	call   2d1c <read>
     7bb:	85 c0                	test   %eax,%eax
     7bd:	0f 8e a5 00 00 00    	jle    868 <pipe1+0x108>
}

// simple fork and pipe read/write

void
pipe1(void)
     7c3:	89 da                	mov    %ebx,%edx
     7c5:	8d 0c 03             	lea    (%ebx,%eax,1),%ecx
     7c8:	f7 da                	neg    %edx
     7ca:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    close(fds[1]);
    total = 0;
    cc = 1;
    while((n = read(fds[0], buf, cc)) > 0){
      for(i = 0; i < n; i++){
        if((buf[i] & 0xff) != (seq++ & 0xff)){
     7d0:	38 9c 13 e0 4a 00 00 	cmp    %bl,0x4ae0(%ebx,%edx,1)
     7d7:	75 1a                	jne    7f3 <pipe1+0x93>
     7d9:	83 c3 01             	add    $0x1,%ebx
  } else if(pid > 0){
    close(fds[1]);
    total = 0;
    cc = 1;
    while((n = read(fds[0], buf, cc)) > 0){
      for(i = 0; i < n; i++){
     7dc:	39 cb                	cmp    %ecx,%ebx
     7de:	75 f0                	jne    7d0 <pipe1+0x70>
          printf(1, "pipe1 oops 2\n");
          return;
        }
      }
      total += n;
      cc = cc * 2;
     7e0:	01 f6                	add    %esi,%esi
        if((buf[i] & 0xff) != (seq++ & 0xff)){
          printf(1, "pipe1 oops 2\n");
          return;
        }
      }
      total += n;
     7e2:	01 c7                	add    %eax,%edi
      cc = cc * 2;
      if(cc > sizeof(buf))
     7e4:	81 fe 00 08 00 00    	cmp    $0x800,%esi
     7ea:	76 b7                	jbe    7a3 <pipe1+0x43>
        cc = sizeof(buf);
     7ec:	be 00 08 00 00       	mov    $0x800,%esi
     7f1:	eb b0                	jmp    7a3 <pipe1+0x43>
    total = 0;
    cc = 1;
    while((n = read(fds[0], buf, cc)) > 0){
      for(i = 0; i < n; i++){
        if((buf[i] & 0xff) != (seq++ & 0xff)){
          printf(1, "pipe1 oops 2\n");
     7f3:	c7 44 24 04 93 33 00 	movl   $0x3393,0x4(%esp)
     7fa:	00 
     7fb:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     802:	e8 49 26 00 00       	call   2e50 <printf>
  } else {
    printf(1, "fork() failed\n");
    exit();
  }
  printf(1, "pipe1 ok\n");
}
     807:	83 c4 20             	add    $0x20,%esp
     80a:	5b                   	pop    %ebx
     80b:	5e                   	pop    %esi
     80c:	5f                   	pop    %edi
     80d:	c3                   	ret    
    exit();
  }
  pid = fork();
  seq = 0;
  if(pid == 0){
    close(fds[0]);
     80e:	8b 44 24 18          	mov    0x18(%esp),%eax
  if(pipe(fds) != 0){
    printf(1, "pipe() failed\n");
    exit();
  }
  pid = fork();
  seq = 0;
     812:	31 f6                	xor    %esi,%esi
  if(pid == 0){
    close(fds[0]);
     814:	89 04 24             	mov    %eax,(%esp)
     817:	e8 10 25 00 00       	call   2d2c <close>
}

// simple fork and pipe read/write

void
pipe1(void)
     81c:	89 f0                	mov    %esi,%eax
     81e:	89 f3                	mov    %esi,%ebx
     820:	8d 96 09 04 00 00    	lea    0x409(%esi),%edx
     826:	f7 d8                	neg    %eax
  seq = 0;
  if(pid == 0){
    close(fds[0]);
    for(n = 0; n < 5; n++){
      for(i = 0; i < 1033; i++)
        buf[i] = seq++;
     828:	88 9c 18 e0 4a 00 00 	mov    %bl,0x4ae0(%eax,%ebx,1)
     82f:	83 c3 01             	add    $0x1,%ebx
  pid = fork();
  seq = 0;
  if(pid == 0){
    close(fds[0]);
    for(n = 0; n < 5; n++){
      for(i = 0; i < 1033; i++)
     832:	39 d3                	cmp    %edx,%ebx
     834:	75 f2                	jne    828 <pipe1+0xc8>
        buf[i] = seq++;
      if(write(fds[1], buf, 1033) != 1033){
     836:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  pid = fork();
  seq = 0;
  if(pid == 0){
    close(fds[0]);
    for(n = 0; n < 5; n++){
      for(i = 0; i < 1033; i++)
     83a:	89 de                	mov    %ebx,%esi
        buf[i] = seq++;
      if(write(fds[1], buf, 1033) != 1033){
     83c:	c7 44 24 08 09 04 00 	movl   $0x409,0x8(%esp)
     843:	00 
     844:	c7 44 24 04 e0 4a 00 	movl   $0x4ae0,0x4(%esp)
     84b:	00 
     84c:	89 04 24             	mov    %eax,(%esp)
     84f:	e8 d0 24 00 00       	call   2d24 <write>
     854:	3d 09 04 00 00       	cmp    $0x409,%eax
     859:	75 57                	jne    8b2 <pipe1+0x152>
  }
  pid = fork();
  seq = 0;
  if(pid == 0){
    close(fds[0]);
    for(n = 0; n < 5; n++){
     85b:	81 fb 2d 14 00 00    	cmp    $0x142d,%ebx
     861:	75 b9                	jne    81c <pipe1+0xbc>
      printf(1, "pipe1 oops 3 total %d\n", total);
    close(fds[0]);
    wait();
  } else {
    printf(1, "fork() failed\n");
    exit();
     863:	e8 9c 24 00 00       	call   2d04 <exit>
      total += n;
      cc = cc * 2;
      if(cc > sizeof(buf))
        cc = sizeof(buf);
    }
    if(total != 5 * 1033)
     868:	81 ff 2d 14 00 00    	cmp    $0x142d,%edi
     86e:	74 18                	je     888 <pipe1+0x128>
      printf(1, "pipe1 oops 3 total %d\n", total);
     870:	89 7c 24 08          	mov    %edi,0x8(%esp)
     874:	c7 44 24 04 a1 33 00 	movl   $0x33a1,0x4(%esp)
     87b:	00 
     87c:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     883:	e8 c8 25 00 00       	call   2e50 <printf>
    close(fds[0]);
     888:	8b 44 24 18          	mov    0x18(%esp),%eax
     88c:	89 04 24             	mov    %eax,(%esp)
     88f:	e8 98 24 00 00       	call   2d2c <close>
    wait();
     894:	e8 73 24 00 00       	call   2d0c <wait>
  } else {
    printf(1, "fork() failed\n");
    exit();
  }
  printf(1, "pipe1 ok\n");
     899:	c7 44 24 04 b8 33 00 	movl   $0x33b8,0x4(%esp)
     8a0:	00 
     8a1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     8a8:	e8 a3 25 00 00       	call   2e50 <printf>
     8ad:	e9 55 ff ff ff       	jmp    807 <pipe1+0xa7>
    close(fds[0]);
    for(n = 0; n < 5; n++){
      for(i = 0; i < 1033; i++)
        buf[i] = seq++;
      if(write(fds[1], buf, 1033) != 1033){
        printf(1, "pipe1 oops 1\n");
     8b2:	c7 44 24 04 85 33 00 	movl   $0x3385,0x4(%esp)
     8b9:	00 
     8ba:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     8c1:	e8 8a 25 00 00       	call   2e50 <printf>
        exit();
     8c6:	e8 39 24 00 00       	call   2d04 <exit>
{
  int fds[2], pid;
  int seq, i, n, cc, total;

  if(pipe(fds) != 0){
    printf(1, "pipe() failed\n");
     8cb:	c7 44 24 04 76 33 00 	movl   $0x3376,0x4(%esp)
     8d2:	00 
     8d3:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     8da:	e8 71 25 00 00       	call   2e50 <printf>
    exit();
     8df:	e8 20 24 00 00       	call   2d04 <exit>
    if(total != 5 * 1033)
      printf(1, "pipe1 oops 3 total %d\n", total);
    close(fds[0]);
    wait();
  } else {
    printf(1, "fork() failed\n");
     8e4:	c7 44 24 04 c2 33 00 	movl   $0x33c2,0x4(%esp)
     8eb:	00 
     8ec:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     8f3:	e8 58 25 00 00       	call   2e50 <printf>
     8f8:	e9 66 ff ff ff       	jmp    863 <pipe1+0x103>
     8fd:	8d 76 00             	lea    0x0(%esi),%esi

00000900 <preempt>:
}

// meant to be run w/ at most two CPUs
void
preempt(void)
{
     900:	57                   	push   %edi
     901:	56                   	push   %esi
     902:	53                   	push   %ebx
     903:	83 ec 20             	sub    $0x20,%esp
  int pid1, pid2, pid3;
  int pfds[2];

  printf(1, "preempt: ");
     906:	c7 44 24 04 d1 33 00 	movl   $0x33d1,0x4(%esp)
     90d:	00 
     90e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     915:	e8 36 25 00 00       	call   2e50 <printf>
  pid1 = fork();
     91a:	e8 dd 23 00 00       	call   2cfc <fork>
  if(pid1 == 0)
     91f:	85 c0                	test   %eax,%eax
{
  int pid1, pid2, pid3;
  int pfds[2];

  printf(1, "preempt: ");
  pid1 = fork();
     921:	89 c7                	mov    %eax,%edi
  if(pid1 == 0)
     923:	75 02                	jne    927 <preempt+0x27>
     925:	eb fe                	jmp    925 <preempt+0x25>
    for(;;)
      ;

  pid2 = fork();
     927:	e8 d0 23 00 00       	call   2cfc <fork>
  if(pid2 == 0)
     92c:	85 c0                	test   %eax,%eax
  pid1 = fork();
  if(pid1 == 0)
    for(;;)
      ;

  pid2 = fork();
     92e:	89 c6                	mov    %eax,%esi
  if(pid2 == 0)
     930:	75 02                	jne    934 <preempt+0x34>
     932:	eb fe                	jmp    932 <preempt+0x32>
    for(;;)
      ;

  pipe(pfds);
     934:	8d 44 24 18          	lea    0x18(%esp),%eax
     938:	89 04 24             	mov    %eax,(%esp)
     93b:	e8 d4 23 00 00       	call   2d14 <pipe>
  pid3 = fork();
     940:	e8 b7 23 00 00       	call   2cfc <fork>
  if(pid3 == 0){
     945:	85 c0                	test   %eax,%eax
  if(pid2 == 0)
    for(;;)
      ;

  pipe(pfds);
  pid3 = fork();
     947:	89 c3                	mov    %eax,%ebx
  if(pid3 == 0){
     949:	75 4f                	jne    99a <preempt+0x9a>
    close(pfds[0]);
     94b:	8b 44 24 18          	mov    0x18(%esp),%eax
     94f:	89 04 24             	mov    %eax,(%esp)
     952:	e8 d5 23 00 00       	call   2d2c <close>
    if(write(pfds[1], "x", 1) != 1)
     957:	8b 44 24 1c          	mov    0x1c(%esp),%eax
     95b:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
     962:	00 
     963:	c7 44 24 04 6d 39 00 	movl   $0x396d,0x4(%esp)
     96a:	00 
     96b:	89 04 24             	mov    %eax,(%esp)
     96e:	e8 b1 23 00 00       	call   2d24 <write>
     973:	83 f8 01             	cmp    $0x1,%eax
     976:	74 14                	je     98c <preempt+0x8c>
      printf(1, "preempt write error");
     978:	c7 44 24 04 db 33 00 	movl   $0x33db,0x4(%esp)
     97f:	00 
     980:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     987:	e8 c4 24 00 00       	call   2e50 <printf>
    close(pfds[1]);
     98c:	8b 44 24 1c          	mov    0x1c(%esp),%eax
     990:	89 04 24             	mov    %eax,(%esp)
     993:	e8 94 23 00 00       	call   2d2c <close>
     998:	eb fe                	jmp    998 <preempt+0x98>
    for(;;)
      ;
  }

  close(pfds[1]);
     99a:	8b 44 24 1c          	mov    0x1c(%esp),%eax
     99e:	89 04 24             	mov    %eax,(%esp)
     9a1:	e8 86 23 00 00       	call   2d2c <close>
  if(read(pfds[0], buf, sizeof(buf)) != 1){
     9a6:	8b 44 24 18          	mov    0x18(%esp),%eax
     9aa:	c7 44 24 08 00 08 00 	movl   $0x800,0x8(%esp)
     9b1:	00 
     9b2:	c7 44 24 04 e0 4a 00 	movl   $0x4ae0,0x4(%esp)
     9b9:	00 
     9ba:	89 04 24             	mov    %eax,(%esp)
     9bd:	e8 5a 23 00 00       	call   2d1c <read>
     9c2:	83 f8 01             	cmp    $0x1,%eax
     9c5:	74 1b                	je     9e2 <preempt+0xe2>
    printf(1, "preempt read error");
     9c7:	c7 44 24 04 ef 33 00 	movl   $0x33ef,0x4(%esp)
     9ce:	00 
     9cf:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     9d6:	e8 75 24 00 00       	call   2e50 <printf>
  printf(1, "wait... ");
  wait();
  wait();
  wait();
  printf(1, "preempt ok\n");
}
     9db:	83 c4 20             	add    $0x20,%esp
     9de:	5b                   	pop    %ebx
     9df:	5e                   	pop    %esi
     9e0:	5f                   	pop    %edi
     9e1:	c3                   	ret    
  close(pfds[1]);
  if(read(pfds[0], buf, sizeof(buf)) != 1){
    printf(1, "preempt read error");
    return;
  }
  close(pfds[0]);
     9e2:	8b 44 24 18          	mov    0x18(%esp),%eax
     9e6:	89 04 24             	mov    %eax,(%esp)
     9e9:	e8 3e 23 00 00       	call   2d2c <close>
  printf(1, "kill... ");
     9ee:	c7 44 24 04 02 34 00 	movl   $0x3402,0x4(%esp)
     9f5:	00 
     9f6:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     9fd:	e8 4e 24 00 00       	call   2e50 <printf>
  kill(pid1);
     a02:	89 3c 24             	mov    %edi,(%esp)
     a05:	e8 2a 23 00 00       	call   2d34 <kill>
  kill(pid2);
     a0a:	89 34 24             	mov    %esi,(%esp)
     a0d:	e8 22 23 00 00       	call   2d34 <kill>
  kill(pid3);
     a12:	89 1c 24             	mov    %ebx,(%esp)
     a15:	e8 1a 23 00 00       	call   2d34 <kill>
  printf(1, "wait... ");
     a1a:	c7 44 24 04 0b 34 00 	movl   $0x340b,0x4(%esp)
     a21:	00 
     a22:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     a29:	e8 22 24 00 00       	call   2e50 <printf>
  wait();
     a2e:	e8 d9 22 00 00       	call   2d0c <wait>
  wait();
     a33:	e8 d4 22 00 00       	call   2d0c <wait>
  wait();
     a38:	e8 cf 22 00 00       	call   2d0c <wait>
  printf(1, "preempt ok\n");
     a3d:	c7 44 24 04 14 34 00 	movl   $0x3414,0x4(%esp)
     a44:	00 
     a45:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     a4c:	e8 ff 23 00 00       	call   2e50 <printf>
     a51:	eb 88                	jmp    9db <preempt+0xdb>
     a53:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
     a59:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000a60 <exitwait>:
}

// try to find any races between exit and wait
void
exitwait(void)
{
     a60:	56                   	push   %esi
     a61:	be 64 00 00 00       	mov    $0x64,%esi
     a66:	53                   	push   %ebx
     a67:	83 ec 14             	sub    $0x14,%esp
     a6a:	eb 16                	jmp    a82 <exitwait+0x22>
     a6c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    pid = fork();
    if(pid < 0){
      printf(1, "fork failed\n");
      return;
    }
    if(pid){
     a70:	74 70                	je     ae2 <exitwait+0x82>
      if(wait() != pid){
     a72:	e8 95 22 00 00       	call   2d0c <wait>
     a77:	39 d8                	cmp    %ebx,%eax
     a79:	75 2d                	jne    aa8 <exitwait+0x48>
void
exitwait(void)
{
  int i, pid;

  for(i = 0; i < 100; i++){
     a7b:	83 ee 01             	sub    $0x1,%esi
     a7e:	66 90                	xchg   %ax,%ax
     a80:	74 46                	je     ac8 <exitwait+0x68>
    pid = fork();
     a82:	e8 75 22 00 00       	call   2cfc <fork>
    if(pid < 0){
     a87:	83 f8 00             	cmp    $0x0,%eax
exitwait(void)
{
  int i, pid;

  for(i = 0; i < 100; i++){
    pid = fork();
     a8a:	89 c3                	mov    %eax,%ebx
    if(pid < 0){
     a8c:	7d e2                	jge    a70 <exitwait+0x10>
      printf(1, "fork failed\n");
     a8e:	c7 44 24 04 20 34 00 	movl   $0x3420,0x4(%esp)
     a95:	00 
     a96:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     a9d:	e8 ae 23 00 00       	call   2e50 <printf>
    } else {
      exit();
    }
  }
  printf(1, "exitwait ok\n");
}
     aa2:	83 c4 14             	add    $0x14,%esp
     aa5:	5b                   	pop    %ebx
     aa6:	5e                   	pop    %esi
     aa7:	c3                   	ret    
      printf(1, "fork failed\n");
      return;
    }
    if(pid){
      if(wait() != pid){
        printf(1, "wait wrong pid\n");
     aa8:	c7 44 24 04 2d 34 00 	movl   $0x342d,0x4(%esp)
     aaf:	00 
     ab0:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     ab7:	e8 94 23 00 00       	call   2e50 <printf>
    } else {
      exit();
    }
  }
  printf(1, "exitwait ok\n");
}
     abc:	83 c4 14             	add    $0x14,%esp
     abf:	5b                   	pop    %ebx
     ac0:	5e                   	pop    %esi
     ac1:	c3                   	ret    
     ac2:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
      }
    } else {
      exit();
    }
  }
  printf(1, "exitwait ok\n");
     ac8:	c7 44 24 04 3d 34 00 	movl   $0x343d,0x4(%esp)
     acf:	00 
     ad0:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     ad7:	e8 74 23 00 00       	call   2e50 <printf>
}
     adc:	83 c4 14             	add    $0x14,%esp
     adf:	5b                   	pop    %ebx
     ae0:	5e                   	pop    %esi
     ae1:	c3                   	ret    
      if(wait() != pid){
        printf(1, "wait wrong pid\n");
        return;
      }
    } else {
      exit();
     ae2:	e8 1d 22 00 00       	call   2d04 <exit>
     ae7:	89 f6                	mov    %esi,%esi
     ae9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000af0 <mem>:
  printf(1, "exitwait ok\n");
}

void
mem(void)
{
     af0:	56                   	push   %esi
     af1:	53                   	push   %ebx
  void *m1, *m2;
  int pid;

  if((pid = fork()) == 0){
     af2:	31 db                	xor    %ebx,%ebx
  printf(1, "exitwait ok\n");
}

void
mem(void)
{
     af4:	83 ec 14             	sub    $0x14,%esp
  void *m1, *m2;
  int pid;

  if((pid = fork()) == 0){
     af7:	e8 00 22 00 00       	call   2cfc <fork>
     afc:	85 c0                	test   %eax,%eax
     afe:	74 0c                	je     b0c <mem+0x1c>
     b00:	eb 67                	jmp    b69 <mem+0x79>
     b02:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    m1 = 0;
    while((m2 = malloc(10001)) != 0) {
      *(char**) m2 = m1;
     b08:	89 18                	mov    %ebx,(%eax)
     b0a:	89 c3                	mov    %eax,%ebx
  void *m1, *m2;
  int pid;

  if((pid = fork()) == 0){
    m1 = 0;
    while((m2 = malloc(10001)) != 0) {
     b0c:	c7 04 24 11 27 00 00 	movl   $0x2711,(%esp)
     b13:	e8 18 25 00 00       	call   3030 <malloc>
     b18:	85 c0                	test   %eax,%eax
     b1a:	75 ec                	jne    b08 <mem+0x18>
      *(char**) m2 = m1;
      m1 = m2;
    }
    while(m1) {
     b1c:	85 db                	test   %ebx,%ebx
     b1e:	75 0a                	jne    b2a <mem+0x3a>
     b20:	eb 16                	jmp    b38 <mem+0x48>
     b22:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
      m2 = *(char**)m1;
      free(m1);
      m1 = m2;
     b28:	89 f3                	mov    %esi,%ebx
    while((m2 = malloc(10001)) != 0) {
      *(char**) m2 = m1;
      m1 = m2;
    }
    while(m1) {
      m2 = *(char**)m1;
     b2a:	8b 33                	mov    (%ebx),%esi
      free(m1);
     b2c:	89 1c 24             	mov    %ebx,(%esp)
     b2f:	e8 7c 24 00 00       	call   2fb0 <free>
    m1 = 0;
    while((m2 = malloc(10001)) != 0) {
      *(char**) m2 = m1;
      m1 = m2;
    }
    while(m1) {
     b34:	85 f6                	test   %esi,%esi
     b36:	75 f0                	jne    b28 <mem+0x38>
      m2 = *(char**)m1;
      free(m1);
      m1 = m2;
    }
    m1 = malloc(1024*20);
     b38:	c7 04 24 00 50 00 00 	movl   $0x5000,(%esp)
     b3f:	e8 ec 24 00 00       	call   3030 <malloc>
    if(m1 == 0) {
     b44:	85 c0                	test   %eax,%eax
     b46:	74 30                	je     b78 <mem+0x88>
      printf(1, "couldn't allocate mem?!!\n");
      exit();
    }
    free(m1);
     b48:	89 04 24             	mov    %eax,(%esp)
     b4b:	e8 60 24 00 00       	call   2fb0 <free>
    printf(1, "mem ok\n");
     b50:	c7 44 24 04 64 34 00 	movl   $0x3464,0x4(%esp)
     b57:	00 
     b58:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     b5f:	e8 ec 22 00 00       	call   2e50 <printf>
    exit();
     b64:	e8 9b 21 00 00       	call   2d04 <exit>
  } else {
    wait();
  }
}
     b69:	83 c4 14             	add    $0x14,%esp
     b6c:	5b                   	pop    %ebx
     b6d:	5e                   	pop    %esi
    }
    free(m1);
    printf(1, "mem ok\n");
    exit();
  } else {
    wait();
     b6e:	e9 99 21 00 00       	jmp    2d0c <wait>
     b73:	90                   	nop
     b74:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
      free(m1);
      m1 = m2;
    }
    m1 = malloc(1024*20);
    if(m1 == 0) {
      printf(1, "couldn't allocate mem?!!\n");
     b78:	c7 44 24 04 4a 34 00 	movl   $0x344a,0x4(%esp)
     b7f:	00 
     b80:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     b87:	e8 c4 22 00 00       	call   2e50 <printf>
      exit();
     b8c:	e8 73 21 00 00       	call   2d04 <exit>
     b91:	eb 0d                	jmp    ba0 <sharedfd>
     b93:	90                   	nop
     b94:	90                   	nop
     b95:	90                   	nop
     b96:	90                   	nop
     b97:	90                   	nop
     b98:	90                   	nop
     b99:	90                   	nop
     b9a:	90                   	nop
     b9b:	90                   	nop
     b9c:	90                   	nop
     b9d:	90                   	nop
     b9e:	90                   	nop
     b9f:	90                   	nop

00000ba0 <sharedfd>:

// two processes write to the same file descriptor
// is the offset shared? does inode locking work?
void
sharedfd(void)
{
     ba0:	55                   	push   %ebp
     ba1:	57                   	push   %edi
     ba2:	56                   	push   %esi
     ba3:	53                   	push   %ebx
     ba4:	83 ec 2c             	sub    $0x2c,%esp
  int fd, pid, i, n, nc, np;
  char buf[10];

  unlink("sharedfd");
     ba7:	c7 04 24 6c 34 00 00 	movl   $0x346c,(%esp)
     bae:	e8 a1 21 00 00       	call   2d54 <unlink>
  fd = open("sharedfd", O_CREATE|O_RDWR);
     bb3:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
     bba:	00 
     bbb:	c7 04 24 6c 34 00 00 	movl   $0x346c,(%esp)
     bc2:	e8 7d 21 00 00       	call   2d44 <open>
  if(fd < 0){
     bc7:	85 c0                	test   %eax,%eax
{
  int fd, pid, i, n, nc, np;
  char buf[10];

  unlink("sharedfd");
  fd = open("sharedfd", O_CREATE|O_RDWR);
     bc9:	89 c7                	mov    %eax,%edi
  if(fd < 0){
     bcb:	0f 88 4c 01 00 00    	js     d1d <sharedfd+0x17d>
    printf(1, "fstests: cannot open sharedfd for writing");
    return;
  }
  pid = fork();
     bd1:	e8 26 21 00 00       	call   2cfc <fork>
  memset(buf, pid==0?'c':'p', sizeof(buf));
     bd6:	8d 74 24 16          	lea    0x16(%esp),%esi
     bda:	bb e8 03 00 00       	mov    $0x3e8,%ebx
     bdf:	c7 44 24 08 0a 00 00 	movl   $0xa,0x8(%esp)
     be6:	00 
     be7:	89 34 24             	mov    %esi,(%esp)
     bea:	83 f8 01             	cmp    $0x1,%eax
  fd = open("sharedfd", O_CREATE|O_RDWR);
  if(fd < 0){
    printf(1, "fstests: cannot open sharedfd for writing");
    return;
  }
  pid = fork();
     bed:	89 c5                	mov    %eax,%ebp
  memset(buf, pid==0?'c':'p', sizeof(buf));
     bef:	19 c0                	sbb    %eax,%eax
     bf1:	83 e0 f3             	and    $0xfffffff3,%eax
     bf4:	83 c0 70             	add    $0x70,%eax
     bf7:	89 44 24 04          	mov    %eax,0x4(%esp)
     bfb:	e8 40 1f 00 00       	call   2b40 <memset>
     c00:	eb 0b                	jmp    c0d <sharedfd+0x6d>
     c02:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  for(i = 0; i < 1000; i++){
     c08:	83 eb 01             	sub    $0x1,%ebx
     c0b:	74 2d                	je     c3a <sharedfd+0x9a>
    if(write(fd, buf, sizeof(buf)) != sizeof(buf)){
     c0d:	c7 44 24 08 0a 00 00 	movl   $0xa,0x8(%esp)
     c14:	00 
     c15:	89 74 24 04          	mov    %esi,0x4(%esp)
     c19:	89 3c 24             	mov    %edi,(%esp)
     c1c:	e8 03 21 00 00       	call   2d24 <write>
     c21:	83 f8 0a             	cmp    $0xa,%eax
     c24:	74 e2                	je     c08 <sharedfd+0x68>
      printf(1, "fstests: write sharedfd failed\n");
     c26:	c7 44 24 04 e0 3e 00 	movl   $0x3ee0,0x4(%esp)
     c2d:	00 
     c2e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     c35:	e8 16 22 00 00       	call   2e50 <printf>
      break;
    }
  }
  if(pid == 0)
     c3a:	85 ed                	test   %ebp,%ebp
     c3c:	0f 84 0d 01 00 00    	je     d4f <sharedfd+0x1af>
    exit();
  else
    wait();
     c42:	e8 c5 20 00 00       	call   2d0c <wait>
  close(fd);
  fd = open("sharedfd", 0);
  if(fd < 0){
     c47:	31 db                	xor    %ebx,%ebx
  }
  if(pid == 0)
    exit();
  else
    wait();
  close(fd);
     c49:	89 3c 24             	mov    %edi,(%esp)
  fd = open("sharedfd", 0);
  if(fd < 0){
     c4c:	31 ff                	xor    %edi,%edi
  }
  if(pid == 0)
    exit();
  else
    wait();
  close(fd);
     c4e:	e8 d9 20 00 00       	call   2d2c <close>
  fd = open("sharedfd", 0);
     c53:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
     c5a:	00 
     c5b:	c7 04 24 6c 34 00 00 	movl   $0x346c,(%esp)
     c62:	e8 dd 20 00 00       	call   2d44 <open>
  if(fd < 0){
     c67:	85 c0                	test   %eax,%eax
  if(pid == 0)
    exit();
  else
    wait();
  close(fd);
  fd = open("sharedfd", 0);
     c69:	89 c5                	mov    %eax,%ebp
  if(fd < 0){
     c6b:	0f 88 c8 00 00 00    	js     d39 <sharedfd+0x199>
     c71:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
    printf(1, "fstests: cannot open sharedfd for reading\n");
    return;
  }
  nc = np = 0;
  while((n = read(fd, buf, sizeof(buf))) > 0){
     c78:	c7 44 24 08 0a 00 00 	movl   $0xa,0x8(%esp)
     c7f:	00 
     c80:	89 74 24 04          	mov    %esi,0x4(%esp)
     c84:	89 2c 24             	mov    %ebp,(%esp)
     c87:	e8 90 20 00 00       	call   2d1c <read>
     c8c:	85 c0                	test   %eax,%eax
     c8e:	7e 29                	jle    cb9 <sharedfd+0x119>
     c90:	31 c0                	xor    %eax,%eax
     c92:	eb 17                	jmp    cab <sharedfd+0x10b>
     c94:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    for(i = 0; i < sizeof(buf); i++){
      if(buf[i] == 'c')
        nc++;
      if(buf[i] == 'p')
        np++;
     c98:	80 fa 70             	cmp    $0x70,%dl
     c9b:	0f 94 c2             	sete   %dl
     c9e:	0f b6 d2             	movzbl %dl,%edx
     ca1:	01 d3                	add    %edx,%ebx
    printf(1, "fstests: cannot open sharedfd for reading\n");
    return;
  }
  nc = np = 0;
  while((n = read(fd, buf, sizeof(buf))) > 0){
    for(i = 0; i < sizeof(buf); i++){
     ca3:	83 c0 01             	add    $0x1,%eax
     ca6:	83 f8 0a             	cmp    $0xa,%eax
     ca9:	74 cd                	je     c78 <sharedfd+0xd8>
      if(buf[i] == 'c')
     cab:	0f b6 14 06          	movzbl (%esi,%eax,1),%edx
     caf:	80 fa 63             	cmp    $0x63,%dl
     cb2:	75 e4                	jne    c98 <sharedfd+0xf8>
        nc++;
     cb4:	83 c7 01             	add    $0x1,%edi
     cb7:	eb ea                	jmp    ca3 <sharedfd+0x103>
      if(buf[i] == 'p')
        np++;
    }
  }
  close(fd);
     cb9:	89 2c 24             	mov    %ebp,(%esp)
     cbc:	e8 6b 20 00 00       	call   2d2c <close>
  unlink("sharedfd");
     cc1:	c7 04 24 6c 34 00 00 	movl   $0x346c,(%esp)
     cc8:	e8 87 20 00 00       	call   2d54 <unlink>
  if(nc == 10000 && np == 10000)
     ccd:	81 fb 10 27 00 00    	cmp    $0x2710,%ebx
     cd3:	74 24                	je     cf9 <sharedfd+0x159>
    printf(1, "sharedfd ok\n");
  else
    printf(1, "sharedfd oops %d %d\n", nc, np);
     cd5:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
     cd9:	89 7c 24 08          	mov    %edi,0x8(%esp)
     cdd:	c7 44 24 04 82 34 00 	movl   $0x3482,0x4(%esp)
     ce4:	00 
     ce5:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     cec:	e8 5f 21 00 00       	call   2e50 <printf>
}
     cf1:	83 c4 2c             	add    $0x2c,%esp
     cf4:	5b                   	pop    %ebx
     cf5:	5e                   	pop    %esi
     cf6:	5f                   	pop    %edi
     cf7:	5d                   	pop    %ebp
     cf8:	c3                   	ret    
        np++;
    }
  }
  close(fd);
  unlink("sharedfd");
  if(nc == 10000 && np == 10000)
     cf9:	81 ff 10 27 00 00    	cmp    $0x2710,%edi
     cff:	75 d4                	jne    cd5 <sharedfd+0x135>
    printf(1, "sharedfd ok\n");
     d01:	c7 44 24 04 75 34 00 	movl   $0x3475,0x4(%esp)
     d08:	00 
     d09:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     d10:	e8 3b 21 00 00       	call   2e50 <printf>
  else
    printf(1, "sharedfd oops %d %d\n", nc, np);
}
     d15:	83 c4 2c             	add    $0x2c,%esp
     d18:	5b                   	pop    %ebx
     d19:	5e                   	pop    %esi
     d1a:	5f                   	pop    %edi
     d1b:	5d                   	pop    %ebp
     d1c:	c3                   	ret    
  char buf[10];

  unlink("sharedfd");
  fd = open("sharedfd", O_CREATE|O_RDWR);
  if(fd < 0){
    printf(1, "fstests: cannot open sharedfd for writing");
     d1d:	c7 44 24 04 b4 3e 00 	movl   $0x3eb4,0x4(%esp)
     d24:	00 
     d25:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     d2c:	e8 1f 21 00 00       	call   2e50 <printf>
  unlink("sharedfd");
  if(nc == 10000 && np == 10000)
    printf(1, "sharedfd ok\n");
  else
    printf(1, "sharedfd oops %d %d\n", nc, np);
}
     d31:	83 c4 2c             	add    $0x2c,%esp
     d34:	5b                   	pop    %ebx
     d35:	5e                   	pop    %esi
     d36:	5f                   	pop    %edi
     d37:	5d                   	pop    %ebp
     d38:	c3                   	ret    
  else
    wait();
  close(fd);
  fd = open("sharedfd", 0);
  if(fd < 0){
    printf(1, "fstests: cannot open sharedfd for reading\n");
     d39:	c7 44 24 04 00 3f 00 	movl   $0x3f00,0x4(%esp)
     d40:	00 
     d41:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     d48:	e8 03 21 00 00       	call   2e50 <printf>
    return;
     d4d:	eb a2                	jmp    cf1 <sharedfd+0x151>
      printf(1, "fstests: write sharedfd failed\n");
      break;
    }
  }
  if(pid == 0)
    exit();
     d4f:	e8 b0 1f 00 00       	call   2d04 <exit>
     d54:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
     d5a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00000d60 <twofiles>:

// two processes write two different files at the same
// time, to test block allocation.
void
twofiles(void)
{
     d60:	55                   	push   %ebp
     d61:	57                   	push   %edi
     d62:	56                   	push   %esi
     d63:	53                   	push   %ebx
     d64:	83 ec 1c             	sub    $0x1c,%esp
  int fd, pid, i, j, n, total;
  char *fname;

  printf(1, "twofiles test\n");
     d67:	c7 44 24 04 97 34 00 	movl   $0x3497,0x4(%esp)
     d6e:	00 
     d6f:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     d76:	e8 d5 20 00 00       	call   2e50 <printf>

  unlink("f1");
     d7b:	c7 04 24 e7 35 00 00 	movl   $0x35e7,(%esp)
     d82:	e8 cd 1f 00 00       	call   2d54 <unlink>
  unlink("f2");
     d87:	c7 04 24 eb 35 00 00 	movl   $0x35eb,(%esp)
     d8e:	e8 c1 1f 00 00       	call   2d54 <unlink>

  pid = fork();
     d93:	e8 64 1f 00 00       	call   2cfc <fork>
  if(pid < 0){
     d98:	83 f8 00             	cmp    $0x0,%eax
  printf(1, "twofiles test\n");

  unlink("f1");
  unlink("f2");

  pid = fork();
     d9b:	89 c7                	mov    %eax,%edi
  if(pid < 0){
     d9d:	0f 8c 5f 01 00 00    	jl     f02 <twofiles+0x1a2>
    printf(1, "fork failed\n");
    return;
  }

  fname = pid ? "f1" : "f2";
     da3:	b8 eb 35 00 00       	mov    $0x35eb,%eax
     da8:	74 05                	je     daf <twofiles+0x4f>
     daa:	b8 e7 35 00 00       	mov    $0x35e7,%eax
  fd = open(fname, O_CREATE | O_RDWR);
     daf:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
     db6:	00 
     db7:	89 04 24             	mov    %eax,(%esp)
     dba:	e8 85 1f 00 00       	call   2d44 <open>
  if(fd < 0){
     dbf:	85 c0                	test   %eax,%eax
    printf(1, "fork failed\n");
    return;
  }

  fname = pid ? "f1" : "f2";
  fd = open(fname, O_CREATE | O_RDWR);
     dc1:	89 c6                	mov    %eax,%esi
  if(fd < 0){
     dc3:	0f 88 8f 01 00 00    	js     f58 <twofiles+0x1f8>
    printf(1, "create failed\n");
    exit();
  }

  memset(buf, pid?'p':'c', 512);
     dc9:	83 ff 01             	cmp    $0x1,%edi
     dcc:	bb 0c 00 00 00       	mov    $0xc,%ebx
     dd1:	19 c0                	sbb    %eax,%eax
     dd3:	83 e0 f3             	and    $0xfffffff3,%eax
     dd6:	83 c0 70             	add    $0x70,%eax
     dd9:	c7 44 24 08 00 02 00 	movl   $0x200,0x8(%esp)
     de0:	00 
     de1:	89 44 24 04          	mov    %eax,0x4(%esp)
     de5:	c7 04 24 e0 4a 00 00 	movl   $0x4ae0,(%esp)
     dec:	e8 4f 1d 00 00       	call   2b40 <memset>
     df1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  for(i = 0; i < 12; i++){
    if((n = write(fd, buf, 500)) != 500){
     df8:	c7 44 24 08 f4 01 00 	movl   $0x1f4,0x8(%esp)
     dff:	00 
     e00:	c7 44 24 04 e0 4a 00 	movl   $0x4ae0,0x4(%esp)
     e07:	00 
     e08:	89 34 24             	mov    %esi,(%esp)
     e0b:	e8 14 1f 00 00       	call   2d24 <write>
     e10:	3d f4 01 00 00       	cmp    $0x1f4,%eax
     e15:	0f 85 20 01 00 00    	jne    f3b <twofiles+0x1db>
    printf(1, "create failed\n");
    exit();
  }

  memset(buf, pid?'p':'c', 512);
  for(i = 0; i < 12; i++){
     e1b:	83 eb 01             	sub    $0x1,%ebx
     e1e:	75 d8                	jne    df8 <twofiles+0x98>
    if((n = write(fd, buf, 500)) != 500){
      printf(1, "write failed %d\n", n);
      exit();
    }
  }
  close(fd);
     e20:	89 34 24             	mov    %esi,(%esp)
     e23:	e8 04 1f 00 00       	call   2d2c <close>
  if(pid)
     e28:	85 ff                	test   %edi,%edi
     e2a:	0f 84 cd 00 00 00    	je     efd <twofiles+0x19d>
    wait();
     e30:	e8 d7 1e 00 00       	call   2d0c <wait>
  else
    exit();

  for(i = 0; i < 2; i++){
     e35:	31 db                	xor    %ebx,%ebx
    fd = open(i?"f1":"f2", 0);
     e37:	b8 eb 35 00 00       	mov    $0x35eb,%eax
     e3c:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
     e43:	00 
    total = 0;
     e44:	31 f6                	xor    %esi,%esi
    wait();
  else
    exit();

  for(i = 0; i < 2; i++){
    fd = open(i?"f1":"f2", 0);
     e46:	89 04 24             	mov    %eax,(%esp)
     e49:	e8 f6 1e 00 00       	call   2d44 <open>
     e4e:	89 c7                	mov    %eax,%edi
    total = 0;
    while((n = read(fd, buf, sizeof(buf))) > 0){
     e50:	c7 44 24 08 00 08 00 	movl   $0x800,0x8(%esp)
     e57:	00 
     e58:	c7 44 24 04 e0 4a 00 	movl   $0x4ae0,0x4(%esp)
     e5f:	00 
     e60:	89 3c 24             	mov    %edi,(%esp)
     e63:	e8 b4 1e 00 00       	call   2d1c <read>
     e68:	85 c0                	test   %eax,%eax
     e6a:	7e 25                	jle    e91 <twofiles+0x131>
     e6c:	31 c9                	xor    %ecx,%ecx
     e6e:	66 90                	xchg   %ax,%ax
      for(j = 0; j < n; j++){
        if(buf[j] != (i?'p':'c')){
     e70:	83 fb 01             	cmp    $0x1,%ebx
     e73:	0f be a9 e0 4a 00 00 	movsbl 0x4ae0(%ecx),%ebp
     e7a:	19 d2                	sbb    %edx,%edx
     e7c:	83 e2 f3             	and    $0xfffffff3,%edx
     e7f:	83 c2 70             	add    $0x70,%edx
     e82:	39 d5                	cmp    %edx,%ebp
     e84:	75 63                	jne    ee9 <twofiles+0x189>

  for(i = 0; i < 2; i++){
    fd = open(i?"f1":"f2", 0);
    total = 0;
    while((n = read(fd, buf, sizeof(buf))) > 0){
      for(j = 0; j < n; j++){
     e86:	83 c1 01             	add    $0x1,%ecx
     e89:	39 c1                	cmp    %eax,%ecx
     e8b:	75 e3                	jne    e70 <twofiles+0x110>
        if(buf[j] != (i?'p':'c')){
          printf(1, "wrong char\n");
          exit();
        }
      }
      total += n;
     e8d:	01 ce                	add    %ecx,%esi
     e8f:	eb bf                	jmp    e50 <twofiles+0xf0>
    }
    close(fd);
     e91:	89 3c 24             	mov    %edi,(%esp)
     e94:	e8 93 1e 00 00       	call   2d2c <close>
    if(total != 12*500){
     e99:	81 fe 70 17 00 00    	cmp    $0x1770,%esi
     e9f:	75 7d                	jne    f1e <twofiles+0x1be>
  if(pid)
    wait();
  else
    exit();

  for(i = 0; i < 2; i++){
     ea1:	83 fb 01             	cmp    $0x1,%ebx
     ea4:	75 34                	jne    eda <twofiles+0x17a>
      printf(1, "wrong length %d\n", total);
      exit();
    }
  }

  unlink("f1");
     ea6:	c7 04 24 e7 35 00 00 	movl   $0x35e7,(%esp)
     ead:	e8 a2 1e 00 00       	call   2d54 <unlink>
  unlink("f2");
     eb2:	c7 04 24 eb 35 00 00 	movl   $0x35eb,(%esp)
     eb9:	e8 96 1e 00 00       	call   2d54 <unlink>

  printf(1, "twofiles ok\n");
     ebe:	c7 44 24 04 d4 34 00 	movl   $0x34d4,0x4(%esp)
     ec5:	00 
     ec6:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     ecd:	e8 7e 1f 00 00       	call   2e50 <printf>
}
     ed2:	83 c4 1c             	add    $0x1c,%esp
     ed5:	5b                   	pop    %ebx
     ed6:	5e                   	pop    %esi
     ed7:	5f                   	pop    %edi
     ed8:	5d                   	pop    %ebp
     ed9:	c3                   	ret    
  if(pid)
    wait();
  else
    exit();

  for(i = 0; i < 2; i++){
     eda:	bb 01 00 00 00       	mov    $0x1,%ebx
     edf:	b8 e7 35 00 00       	mov    $0x35e7,%eax
     ee4:	e9 53 ff ff ff       	jmp    e3c <twofiles+0xdc>
    fd = open(i?"f1":"f2", 0);
    total = 0;
    while((n = read(fd, buf, sizeof(buf))) > 0){
      for(j = 0; j < n; j++){
        if(buf[j] != (i?'p':'c')){
          printf(1, "wrong char\n");
     ee9:	c7 44 24 04 b7 34 00 	movl   $0x34b7,0x4(%esp)
     ef0:	00 
     ef1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     ef8:	e8 53 1f 00 00       	call   2e50 <printf>
          exit();
     efd:	e8 02 1e 00 00       	call   2d04 <exit>
  unlink("f1");
  unlink("f2");

  pid = fork();
  if(pid < 0){
    printf(1, "fork failed\n");
     f02:	c7 44 24 04 20 34 00 	movl   $0x3420,0x4(%esp)
     f09:	00 
     f0a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     f11:	e8 3a 1f 00 00       	call   2e50 <printf>

  unlink("f1");
  unlink("f2");

  printf(1, "twofiles ok\n");
}
     f16:	83 c4 1c             	add    $0x1c,%esp
     f19:	5b                   	pop    %ebx
     f1a:	5e                   	pop    %esi
     f1b:	5f                   	pop    %edi
     f1c:	5d                   	pop    %ebp
     f1d:	c3                   	ret    
      }
      total += n;
    }
    close(fd);
    if(total != 12*500){
      printf(1, "wrong length %d\n", total);
     f1e:	89 74 24 08          	mov    %esi,0x8(%esp)
     f22:	c7 44 24 04 c3 34 00 	movl   $0x34c3,0x4(%esp)
     f29:	00 
     f2a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     f31:	e8 1a 1f 00 00       	call   2e50 <printf>
      exit();
     f36:	e8 c9 1d 00 00       	call   2d04 <exit>
  }

  memset(buf, pid?'p':'c', 512);
  for(i = 0; i < 12; i++){
    if((n = write(fd, buf, 500)) != 500){
      printf(1, "write failed %d\n", n);
     f3b:	89 44 24 08          	mov    %eax,0x8(%esp)
     f3f:	c7 44 24 04 a6 34 00 	movl   $0x34a6,0x4(%esp)
     f46:	00 
     f47:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     f4e:	e8 fd 1e 00 00       	call   2e50 <printf>
      exit();
     f53:	e8 ac 1d 00 00       	call   2d04 <exit>
  }

  fname = pid ? "f1" : "f2";
  fd = open(fname, O_CREATE | O_RDWR);
  if(fd < 0){
    printf(1, "create failed\n");
     f58:	c7 44 24 04 1b 37 00 	movl   $0x371b,0x4(%esp)
     f5f:	00 
     f60:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     f67:	e8 e4 1e 00 00       	call   2e50 <printf>
    exit();
     f6c:	e8 93 1d 00 00       	call   2d04 <exit>
     f71:	eb 0d                	jmp    f80 <createdelete>
     f73:	90                   	nop
     f74:	90                   	nop
     f75:	90                   	nop
     f76:	90                   	nop
     f77:	90                   	nop
     f78:	90                   	nop
     f79:	90                   	nop
     f7a:	90                   	nop
     f7b:	90                   	nop
     f7c:	90                   	nop
     f7d:	90                   	nop
     f7e:	90                   	nop
     f7f:	90                   	nop

00000f80 <createdelete>:
}

// two processes create and delete different files in same directory
void
createdelete(void)
{
     f80:	55                   	push   %ebp
     f81:	57                   	push   %edi
     f82:	56                   	push   %esi
     f83:	53                   	push   %ebx
     f84:	83 ec 4c             	sub    $0x4c,%esp
  enum { N = 20 };
  int pid, i, fd;
  char name[32];

  printf(1, "createdelete test\n");
     f87:	c7 44 24 04 e1 34 00 	movl   $0x34e1,0x4(%esp)
     f8e:	00 
     f8f:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
     f96:	e8 b5 1e 00 00       	call   2e50 <printf>
  pid = fork();
     f9b:	e8 5c 1d 00 00       	call   2cfc <fork>
  if(pid < 0){
     fa0:	85 c0                	test   %eax,%eax
  enum { N = 20 };
  int pid, i, fd;
  char name[32];

  printf(1, "createdelete test\n");
  pid = fork();
     fa2:	89 c5                	mov    %eax,%ebp
  if(pid < 0){
     fa4:	0f 88 15 02 00 00    	js     11bf <createdelete+0x23f>
    printf(1, "fork failed\n");
    exit();
  }

  name[0] = pid ? 'p' : 'c';
     faa:	83 f8 01             	cmp    $0x1,%eax
  name[2] = '\0';
     fad:	bf 01 00 00 00       	mov    $0x1,%edi
  if(pid < 0){
    printf(1, "fork failed\n");
    exit();
  }

  name[0] = pid ? 'p' : 'c';
     fb2:	19 c0                	sbb    %eax,%eax
  name[2] = '\0';
     fb4:	31 db                	xor    %ebx,%ebx
  if(pid < 0){
    printf(1, "fork failed\n");
    exit();
  }

  name[0] = pid ? 'p' : 'c';
     fb6:	83 e0 f3             	and    $0xfffffff3,%eax
     fb9:	83 c0 70             	add    $0x70,%eax
     fbc:	88 44 24 20          	mov    %al,0x20(%esp)
     fc0:	8d 74 24 20          	lea    0x20(%esp),%esi
  name[2] = '\0';
     fc4:	c6 44 24 22 00       	movb   $0x0,0x22(%esp)
     fc9:	eb 10                	jmp    fdb <createdelete+0x5b>
     fcb:	90                   	nop
     fcc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  for(i = 0; i < N; i++){
     fd0:	83 ff 14             	cmp    $0x14,%edi
     fd3:	74 6b                	je     1040 <createdelete+0xc0>
    printf(1, "fork failed\n");
    exit();
  }

  name[0] = pid ? 'p' : 'c';
  name[2] = '\0';
     fd5:	83 c3 01             	add    $0x1,%ebx
     fd8:	83 c7 01             	add    $0x1,%edi
  printf(1, "twofiles ok\n");
}

// two processes create and delete different files in same directory
void
createdelete(void)
     fdb:	8d 43 30             	lea    0x30(%ebx),%eax
     fde:	88 44 24 21          	mov    %al,0x21(%esp)

  name[0] = pid ? 'p' : 'c';
  name[2] = '\0';
  for(i = 0; i < N; i++){
    name[1] = '0' + i;
    fd = open(name, O_CREATE | O_RDWR);
     fe2:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
     fe9:	00 
     fea:	89 34 24             	mov    %esi,(%esp)
     fed:	e8 52 1d 00 00       	call   2d44 <open>
    if(fd < 0){
     ff2:	85 c0                	test   %eax,%eax
     ff4:	0f 88 38 01 00 00    	js     1132 <createdelete+0x1b2>
      printf(1, "create failed\n");
      exit();
    }
    close(fd);
     ffa:	89 04 24             	mov    %eax,(%esp)
     ffd:	e8 2a 1d 00 00       	call   2d2c <close>
    if(i > 0 && (i % 2 ) == 0){
    1002:	85 db                	test   %ebx,%ebx
    1004:	74 cf                	je     fd5 <createdelete+0x55>
    1006:	f6 c3 01             	test   $0x1,%bl
    1009:	75 c5                	jne    fd0 <createdelete+0x50>
      name[1] = '0' + (i / 2);
    100b:	89 d8                	mov    %ebx,%eax
    100d:	d1 f8                	sar    %eax
    100f:	83 c0 30             	add    $0x30,%eax
    1012:	88 44 24 21          	mov    %al,0x21(%esp)
      if(unlink(name) < 0){
    1016:	89 34 24             	mov    %esi,(%esp)
    1019:	e8 36 1d 00 00       	call   2d54 <unlink>
    101e:	85 c0                	test   %eax,%eax
    1020:	79 ae                	jns    fd0 <createdelete+0x50>
        printf(1, "unlink failed\n");
    1022:	c7 44 24 04 f4 34 00 	movl   $0x34f4,0x4(%esp)
    1029:	00 
    102a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1031:	e8 1a 1e 00 00       	call   2e50 <printf>
        exit();
    1036:	e8 c9 1c 00 00       	call   2d04 <exit>
    103b:	90                   	nop
    103c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
      }
    }
  }

  if(pid==0)
    1040:	85 ed                	test   %ebp,%ebp
    1042:	0f 84 72 01 00 00    	je     11ba <createdelete+0x23a>
    exit();
  else
    wait();
    1048:	e8 bf 1c 00 00       	call   2d0c <wait>

  for(i = 0; i < N; i++){
    104d:	31 db                	xor    %ebx,%ebx
    104f:	90                   	nop
  printf(1, "twofiles ok\n");
}

// two processes create and delete different files in same directory
void
createdelete(void)
    1050:	8d 7b 30             	lea    0x30(%ebx),%edi
  else
    wait();

  for(i = 0; i < N; i++){
    name[0] = 'p';
    name[1] = '0' + i;
    1053:	89 f8                	mov    %edi,%eax
    exit();
  else
    wait();

  for(i = 0; i < N; i++){
    name[0] = 'p';
    1055:	c6 44 24 20 70       	movb   $0x70,0x20(%esp)
    name[1] = '0' + i;
    105a:	88 44 24 21          	mov    %al,0x21(%esp)
    fd = open(name, 0);
    105e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    1065:	00 
    1066:	89 34 24             	mov    %esi,(%esp)
    1069:	e8 d6 1c 00 00       	call   2d44 <open>
    if((i == 0 || i >= N/2) && fd < 0){
    106e:	83 fb 09             	cmp    $0x9,%ebx
    1071:	0f 9f c1             	setg   %cl
    1074:	85 db                	test   %ebx,%ebx
    1076:	0f 94 c2             	sete   %dl
    1079:	08 d1                	or     %dl,%cl
    107b:	88 4c 24 1f          	mov    %cl,0x1f(%esp)
    107f:	74 08                	je     1089 <createdelete+0x109>
    1081:	85 c0                	test   %eax,%eax
    1083:	0f 88 19 01 00 00    	js     11a2 <createdelete+0x222>
      printf(1, "oops createdelete %s didn't exist\n", name);
      exit();
    } else if((i >= 1 && i < N/2) && fd >= 0){
    1089:	8d 53 ff             	lea    -0x1(%ebx),%edx
    108c:	83 fa 08             	cmp    $0x8,%edx
    108f:	0f 96 c2             	setbe  %dl
    1092:	89 d5                	mov    %edx,%ebp
    1094:	89 c2                	mov    %eax,%edx
    1096:	f7 d2                	not    %edx
    1098:	89 e9                	mov    %ebp,%ecx
    109a:	c1 ea 1f             	shr    $0x1f,%edx
    109d:	84 c9                	test   %cl,%cl
    109f:	0f 85 bb 00 00 00    	jne    1160 <createdelete+0x1e0>
      printf(1, "oops createdelete %s did exist\n", name);
      exit();
    }
    if(fd >= 0)
    10a5:	84 d2                	test   %dl,%dl
    10a7:	74 08                	je     10b1 <createdelete+0x131>
      close(fd);
    10a9:	89 04 24             	mov    %eax,(%esp)
    10ac:	e8 7b 1c 00 00       	call   2d2c <close>

    name[0] = 'c';
    name[1] = '0' + i;
    10b1:	89 f8                	mov    %edi,%eax
      exit();
    }
    if(fd >= 0)
      close(fd);

    name[0] = 'c';
    10b3:	c6 44 24 20 63       	movb   $0x63,0x20(%esp)
    name[1] = '0' + i;
    10b8:	88 44 24 21          	mov    %al,0x21(%esp)
    fd = open(name, 0);
    10bc:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    10c3:	00 
    10c4:	89 34 24             	mov    %esi,(%esp)
    10c7:	e8 78 1c 00 00       	call   2d44 <open>
    if((i == 0 || i >= N/2) && fd < 0){
    10cc:	80 7c 24 1f 00       	cmpb   $0x0,0x1f(%esp)
    10d1:	74 08                	je     10db <createdelete+0x15b>
    10d3:	85 c0                	test   %eax,%eax
    10d5:	0f 88 aa 00 00 00    	js     1185 <createdelete+0x205>
      printf(1, "oops createdelete %s didn't exist\n", name);
      exit();
    } else if((i >= 1 && i < N/2) && fd >= 0){
    10db:	85 c0                	test   %eax,%eax
    10dd:	79 6c                	jns    114b <createdelete+0x1cb>
  if(pid==0)
    exit();
  else
    wait();

  for(i = 0; i < N; i++){
    10df:	83 c3 01             	add    $0x1,%ebx
    10e2:	83 fb 14             	cmp    $0x14,%ebx
    10e5:	0f 85 65 ff ff ff    	jne    1050 <createdelete+0xd0>
    10eb:	bb 30 00 00 00       	mov    $0x30,%ebx
      close(fd);
  }

  for(i = 0; i < N; i++){
    name[0] = 'p';
    name[1] = '0' + i;
    10f0:	88 5c 24 21          	mov    %bl,0x21(%esp)
    unlink(name);
    name[0] = 'c';
    unlink(name);
    10f4:	83 c3 01             	add    $0x1,%ebx
    if(fd >= 0)
      close(fd);
  }

  for(i = 0; i < N; i++){
    name[0] = 'p';
    10f7:	c6 44 24 20 70       	movb   $0x70,0x20(%esp)
    name[1] = '0' + i;
    unlink(name);
    10fc:	89 34 24             	mov    %esi,(%esp)
    10ff:	e8 50 1c 00 00       	call   2d54 <unlink>
    name[0] = 'c';
    1104:	c6 44 24 20 63       	movb   $0x63,0x20(%esp)
    unlink(name);
    1109:	89 34 24             	mov    %esi,(%esp)
    110c:	e8 43 1c 00 00       	call   2d54 <unlink>
    }
    if(fd >= 0)
      close(fd);
  }

  for(i = 0; i < N; i++){
    1111:	80 fb 44             	cmp    $0x44,%bl
    1114:	75 da                	jne    10f0 <createdelete+0x170>
    unlink(name);
    name[0] = 'c';
    unlink(name);
  }

  printf(1, "createdelete ok\n");
    1116:	c7 44 24 04 03 35 00 	movl   $0x3503,0x4(%esp)
    111d:	00 
    111e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1125:	e8 26 1d 00 00       	call   2e50 <printf>
}
    112a:	83 c4 4c             	add    $0x4c,%esp
    112d:	5b                   	pop    %ebx
    112e:	5e                   	pop    %esi
    112f:	5f                   	pop    %edi
    1130:	5d                   	pop    %ebp
    1131:	c3                   	ret    
  name[2] = '\0';
  for(i = 0; i < N; i++){
    name[1] = '0' + i;
    fd = open(name, O_CREATE | O_RDWR);
    if(fd < 0){
      printf(1, "create failed\n");
    1132:	c7 44 24 04 1b 37 00 	movl   $0x371b,0x4(%esp)
    1139:	00 
    113a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1141:	e8 0a 1d 00 00       	call   2e50 <printf>
      exit();
    1146:	e8 b9 1b 00 00       	call   2d04 <exit>
    name[1] = '0' + i;
    fd = open(name, 0);
    if((i == 0 || i >= N/2) && fd < 0){
      printf(1, "oops createdelete %s didn't exist\n", name);
      exit();
    } else if((i >= 1 && i < N/2) && fd >= 0){
    114b:	89 ea                	mov    %ebp,%edx
    114d:	84 d2                	test   %dl,%dl
    114f:	75 17                	jne    1168 <createdelete+0x1e8>
      printf(1, "oops createdelete %s did exist\n", name);
      exit();
    }
    if(fd >= 0)
      close(fd);
    1151:	89 04 24             	mov    %eax,(%esp)
    1154:	e8 d3 1b 00 00       	call   2d2c <close>
    1159:	eb 84                	jmp    10df <createdelete+0x15f>
    115b:	90                   	nop
    115c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    name[1] = '0' + i;
    fd = open(name, 0);
    if((i == 0 || i >= N/2) && fd < 0){
      printf(1, "oops createdelete %s didn't exist\n", name);
      exit();
    } else if((i >= 1 && i < N/2) && fd >= 0){
    1160:	84 d2                	test   %dl,%dl
    1162:	0f 84 49 ff ff ff    	je     10b1 <createdelete+0x131>
    fd = open(name, 0);
    if((i == 0 || i >= N/2) && fd < 0){
      printf(1, "oops createdelete %s didn't exist\n", name);
      exit();
    } else if((i >= 1 && i < N/2) && fd >= 0){
      printf(1, "oops createdelete %s did exist\n", name);
    1168:	89 74 24 08          	mov    %esi,0x8(%esp)
    116c:	c7 44 24 04 50 3f 00 	movl   $0x3f50,0x4(%esp)
    1173:	00 
    1174:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    117b:	e8 d0 1c 00 00       	call   2e50 <printf>
      exit();
    1180:	e8 7f 1b 00 00       	call   2d04 <exit>

    name[0] = 'c';
    name[1] = '0' + i;
    fd = open(name, 0);
    if((i == 0 || i >= N/2) && fd < 0){
      printf(1, "oops createdelete %s didn't exist\n", name);
    1185:	89 74 24 08          	mov    %esi,0x8(%esp)
    1189:	c7 44 24 04 2c 3f 00 	movl   $0x3f2c,0x4(%esp)
    1190:	00 
    1191:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1198:	e8 b3 1c 00 00       	call   2e50 <printf>
      exit();
    119d:	e8 62 1b 00 00       	call   2d04 <exit>
  for(i = 0; i < N; i++){
    name[0] = 'p';
    name[1] = '0' + i;
    fd = open(name, 0);
    if((i == 0 || i >= N/2) && fd < 0){
      printf(1, "oops createdelete %s didn't exist\n", name);
    11a2:	89 74 24 08          	mov    %esi,0x8(%esp)
    11a6:	c7 44 24 04 2c 3f 00 	movl   $0x3f2c,0x4(%esp)
    11ad:	00 
    11ae:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    11b5:	e8 96 1c 00 00       	call   2e50 <printf>
      exit();
    11ba:	e8 45 1b 00 00       	call   2d04 <exit>
  char name[32];

  printf(1, "createdelete test\n");
  pid = fork();
  if(pid < 0){
    printf(1, "fork failed\n");
    11bf:	c7 44 24 04 20 34 00 	movl   $0x3420,0x4(%esp)
    11c6:	00 
    11c7:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    11ce:	e8 7d 1c 00 00       	call   2e50 <printf>
    exit();
    11d3:	e8 2c 1b 00 00       	call   2d04 <exit>
    11d8:	90                   	nop
    11d9:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

000011e0 <unlinkread>:
}

// can I unlink a file and still read it?
void
unlinkread(void)
{
    11e0:	56                   	push   %esi
    11e1:	53                   	push   %ebx
    11e2:	83 ec 14             	sub    $0x14,%esp
  int fd, fd1;

  printf(1, "unlinkread test\n");
    11e5:	c7 44 24 04 14 35 00 	movl   $0x3514,0x4(%esp)
    11ec:	00 
    11ed:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    11f4:	e8 57 1c 00 00       	call   2e50 <printf>
  fd = open("unlinkread", O_CREATE | O_RDWR);
    11f9:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
    1200:	00 
    1201:	c7 04 24 25 35 00 00 	movl   $0x3525,(%esp)
    1208:	e8 37 1b 00 00       	call   2d44 <open>
  if(fd < 0){
    120d:	85 c0                	test   %eax,%eax
unlinkread(void)
{
  int fd, fd1;

  printf(1, "unlinkread test\n");
  fd = open("unlinkread", O_CREATE | O_RDWR);
    120f:	89 c3                	mov    %eax,%ebx
  if(fd < 0){
    1211:	0f 88 fd 00 00 00    	js     1314 <unlinkread+0x134>
    printf(1, "create unlinkread failed\n");
    exit();
  }
  write(fd, "hello", 5);
    1217:	c7 44 24 08 05 00 00 	movl   $0x5,0x8(%esp)
    121e:	00 
    121f:	c7 44 24 04 4a 35 00 	movl   $0x354a,0x4(%esp)
    1226:	00 
    1227:	89 04 24             	mov    %eax,(%esp)
    122a:	e8 f5 1a 00 00       	call   2d24 <write>
  close(fd);
    122f:	89 1c 24             	mov    %ebx,(%esp)
    1232:	e8 f5 1a 00 00       	call   2d2c <close>

  fd = open("unlinkread", O_RDWR);
    1237:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
    123e:	00 
    123f:	c7 04 24 25 35 00 00 	movl   $0x3525,(%esp)
    1246:	e8 f9 1a 00 00       	call   2d44 <open>
  if(fd < 0){
    124b:	85 c0                	test   %eax,%eax
    exit();
  }
  write(fd, "hello", 5);
  close(fd);

  fd = open("unlinkread", O_RDWR);
    124d:	89 c3                	mov    %eax,%ebx
  if(fd < 0){
    124f:	0f 88 3c 01 00 00    	js     1391 <unlinkread+0x1b1>
    printf(1, "open unlinkread failed\n");
    exit();
  }
  if(unlink("unlinkread") != 0){
    1255:	c7 04 24 25 35 00 00 	movl   $0x3525,(%esp)
    125c:	e8 f3 1a 00 00       	call   2d54 <unlink>
    1261:	85 c0                	test   %eax,%eax
    1263:	0f 85 0f 01 00 00    	jne    1378 <unlinkread+0x198>
    printf(1, "unlink unlinkread failed\n");
    exit();
  }

  fd1 = open("unlinkread", O_CREATE | O_RDWR);
    1269:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
    1270:	00 
    1271:	c7 04 24 25 35 00 00 	movl   $0x3525,(%esp)
    1278:	e8 c7 1a 00 00       	call   2d44 <open>
  write(fd1, "yyy", 3);
    127d:	c7 44 24 08 03 00 00 	movl   $0x3,0x8(%esp)
    1284:	00 
    1285:	c7 44 24 04 82 35 00 	movl   $0x3582,0x4(%esp)
    128c:	00 
  if(unlink("unlinkread") != 0){
    printf(1, "unlink unlinkread failed\n");
    exit();
  }

  fd1 = open("unlinkread", O_CREATE | O_RDWR);
    128d:	89 c6                	mov    %eax,%esi
  write(fd1, "yyy", 3);
    128f:	89 04 24             	mov    %eax,(%esp)
    1292:	e8 8d 1a 00 00       	call   2d24 <write>
  close(fd1);
    1297:	89 34 24             	mov    %esi,(%esp)
    129a:	e8 8d 1a 00 00       	call   2d2c <close>

  if(read(fd, buf, sizeof(buf)) != 5){
    129f:	c7 44 24 08 00 08 00 	movl   $0x800,0x8(%esp)
    12a6:	00 
    12a7:	c7 44 24 04 e0 4a 00 	movl   $0x4ae0,0x4(%esp)
    12ae:	00 
    12af:	89 1c 24             	mov    %ebx,(%esp)
    12b2:	e8 65 1a 00 00       	call   2d1c <read>
    12b7:	83 f8 05             	cmp    $0x5,%eax
    12ba:	0f 85 9f 00 00 00    	jne    135f <unlinkread+0x17f>
    printf(1, "unlinkread read failed");
    exit();
  }
  if(buf[0] != 'h'){
    12c0:	80 3d e0 4a 00 00 68 	cmpb   $0x68,0x4ae0
    12c7:	75 7d                	jne    1346 <unlinkread+0x166>
    printf(1, "unlinkread wrong data\n");
    exit();
  }
  if(write(fd, buf, 10) != 10){
    12c9:	c7 44 24 08 0a 00 00 	movl   $0xa,0x8(%esp)
    12d0:	00 
    12d1:	c7 44 24 04 e0 4a 00 	movl   $0x4ae0,0x4(%esp)
    12d8:	00 
    12d9:	89 1c 24             	mov    %ebx,(%esp)
    12dc:	e8 43 1a 00 00       	call   2d24 <write>
    12e1:	83 f8 0a             	cmp    $0xa,%eax
    12e4:	75 47                	jne    132d <unlinkread+0x14d>
    printf(1, "unlinkread write failed\n");
    exit();
  }
  close(fd);
    12e6:	89 1c 24             	mov    %ebx,(%esp)
    12e9:	e8 3e 1a 00 00       	call   2d2c <close>
  unlink("unlinkread");
    12ee:	c7 04 24 25 35 00 00 	movl   $0x3525,(%esp)
    12f5:	e8 5a 1a 00 00       	call   2d54 <unlink>
  printf(1, "unlinkread ok\n");
    12fa:	c7 44 24 04 cd 35 00 	movl   $0x35cd,0x4(%esp)
    1301:	00 
    1302:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1309:	e8 42 1b 00 00       	call   2e50 <printf>
}
    130e:	83 c4 14             	add    $0x14,%esp
    1311:	5b                   	pop    %ebx
    1312:	5e                   	pop    %esi
    1313:	c3                   	ret    
  int fd, fd1;

  printf(1, "unlinkread test\n");
  fd = open("unlinkread", O_CREATE | O_RDWR);
  if(fd < 0){
    printf(1, "create unlinkread failed\n");
    1314:	c7 44 24 04 30 35 00 	movl   $0x3530,0x4(%esp)
    131b:	00 
    131c:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1323:	e8 28 1b 00 00       	call   2e50 <printf>
    exit();
    1328:	e8 d7 19 00 00       	call   2d04 <exit>
  if(buf[0] != 'h'){
    printf(1, "unlinkread wrong data\n");
    exit();
  }
  if(write(fd, buf, 10) != 10){
    printf(1, "unlinkread write failed\n");
    132d:	c7 44 24 04 b4 35 00 	movl   $0x35b4,0x4(%esp)
    1334:	00 
    1335:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    133c:	e8 0f 1b 00 00       	call   2e50 <printf>
    exit();
    1341:	e8 be 19 00 00       	call   2d04 <exit>
  if(read(fd, buf, sizeof(buf)) != 5){
    printf(1, "unlinkread read failed");
    exit();
  }
  if(buf[0] != 'h'){
    printf(1, "unlinkread wrong data\n");
    1346:	c7 44 24 04 9d 35 00 	movl   $0x359d,0x4(%esp)
    134d:	00 
    134e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1355:	e8 f6 1a 00 00       	call   2e50 <printf>
    exit();
    135a:	e8 a5 19 00 00       	call   2d04 <exit>
  fd1 = open("unlinkread", O_CREATE | O_RDWR);
  write(fd1, "yyy", 3);
  close(fd1);

  if(read(fd, buf, sizeof(buf)) != 5){
    printf(1, "unlinkread read failed");
    135f:	c7 44 24 04 86 35 00 	movl   $0x3586,0x4(%esp)
    1366:	00 
    1367:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    136e:	e8 dd 1a 00 00       	call   2e50 <printf>
    exit();
    1373:	e8 8c 19 00 00       	call   2d04 <exit>
  if(fd < 0){
    printf(1, "open unlinkread failed\n");
    exit();
  }
  if(unlink("unlinkread") != 0){
    printf(1, "unlink unlinkread failed\n");
    1378:	c7 44 24 04 68 35 00 	movl   $0x3568,0x4(%esp)
    137f:	00 
    1380:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1387:	e8 c4 1a 00 00       	call   2e50 <printf>
    exit();
    138c:	e8 73 19 00 00       	call   2d04 <exit>
  write(fd, "hello", 5);
  close(fd);

  fd = open("unlinkread", O_RDWR);
  if(fd < 0){
    printf(1, "open unlinkread failed\n");
    1391:	c7 44 24 04 50 35 00 	movl   $0x3550,0x4(%esp)
    1398:	00 
    1399:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    13a0:	e8 ab 1a 00 00       	call   2e50 <printf>
    exit();
    13a5:	e8 5a 19 00 00       	call   2d04 <exit>
    13aa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

000013b0 <linktest>:
  printf(1, "unlinkread ok\n");
}

void
linktest(void)
{
    13b0:	53                   	push   %ebx
    13b1:	83 ec 18             	sub    $0x18,%esp
  int fd;

  printf(1, "linktest\n");
    13b4:	c7 44 24 04 dc 35 00 	movl   $0x35dc,0x4(%esp)
    13bb:	00 
    13bc:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    13c3:	e8 88 1a 00 00       	call   2e50 <printf>

  unlink("lf1");
    13c8:	c7 04 24 e6 35 00 00 	movl   $0x35e6,(%esp)
    13cf:	e8 80 19 00 00       	call   2d54 <unlink>
  unlink("lf2");
    13d4:	c7 04 24 ea 35 00 00 	movl   $0x35ea,(%esp)
    13db:	e8 74 19 00 00       	call   2d54 <unlink>

  fd = open("lf1", O_CREATE|O_RDWR);
    13e0:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
    13e7:	00 
    13e8:	c7 04 24 e6 35 00 00 	movl   $0x35e6,(%esp)
    13ef:	e8 50 19 00 00       	call   2d44 <open>
  if(fd < 0){
    13f4:	85 c0                	test   %eax,%eax
  printf(1, "linktest\n");

  unlink("lf1");
  unlink("lf2");

  fd = open("lf1", O_CREATE|O_RDWR);
    13f6:	89 c3                	mov    %eax,%ebx
  if(fd < 0){
    13f8:	0f 88 25 01 00 00    	js     1523 <linktest+0x173>
    printf(1, "create lf1 failed\n");
    exit();
  }
  if(write(fd, "hello", 5) != 5){
    13fe:	c7 44 24 08 05 00 00 	movl   $0x5,0x8(%esp)
    1405:	00 
    1406:	c7 44 24 04 4a 35 00 	movl   $0x354a,0x4(%esp)
    140d:	00 
    140e:	89 04 24             	mov    %eax,(%esp)
    1411:	e8 0e 19 00 00       	call   2d24 <write>
    1416:	83 f8 05             	cmp    $0x5,%eax
    1419:	0f 85 cc 01 00 00    	jne    15eb <linktest+0x23b>
    printf(1, "write lf1 failed\n");
    exit();
  }
  close(fd);
    141f:	89 1c 24             	mov    %ebx,(%esp)
    1422:	e8 05 19 00 00       	call   2d2c <close>

  if(link("lf1", "lf2") < 0){
    1427:	c7 44 24 04 ea 35 00 	movl   $0x35ea,0x4(%esp)
    142e:	00 
    142f:	c7 04 24 e6 35 00 00 	movl   $0x35e6,(%esp)
    1436:	e8 29 19 00 00       	call   2d64 <link>
    143b:	85 c0                	test   %eax,%eax
    143d:	0f 88 8f 01 00 00    	js     15d2 <linktest+0x222>
    printf(1, "link lf1 lf2 failed\n");
    exit();
  }
  unlink("lf1");
    1443:	c7 04 24 e6 35 00 00 	movl   $0x35e6,(%esp)
    144a:	e8 05 19 00 00       	call   2d54 <unlink>

  if(open("lf1", 0) >= 0){
    144f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    1456:	00 
    1457:	c7 04 24 e6 35 00 00 	movl   $0x35e6,(%esp)
    145e:	e8 e1 18 00 00       	call   2d44 <open>
    1463:	85 c0                	test   %eax,%eax
    1465:	0f 89 4e 01 00 00    	jns    15b9 <linktest+0x209>
    printf(1, "unlinked lf1 but it is still there!\n");
    exit();
  }

  fd = open("lf2", 0);
    146b:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    1472:	00 
    1473:	c7 04 24 ea 35 00 00 	movl   $0x35ea,(%esp)
    147a:	e8 c5 18 00 00       	call   2d44 <open>
  if(fd < 0){
    147f:	85 c0                	test   %eax,%eax
  if(open("lf1", 0) >= 0){
    printf(1, "unlinked lf1 but it is still there!\n");
    exit();
  }

  fd = open("lf2", 0);
    1481:	89 c3                	mov    %eax,%ebx
  if(fd < 0){
    1483:	0f 88 17 01 00 00    	js     15a0 <linktest+0x1f0>
    printf(1, "open lf2 failed\n");
    exit();
  }
  if(read(fd, buf, sizeof(buf)) != 5){
    1489:	c7 44 24 08 00 08 00 	movl   $0x800,0x8(%esp)
    1490:	00 
    1491:	c7 44 24 04 e0 4a 00 	movl   $0x4ae0,0x4(%esp)
    1498:	00 
    1499:	89 04 24             	mov    %eax,(%esp)
    149c:	e8 7b 18 00 00       	call   2d1c <read>
    14a1:	83 f8 05             	cmp    $0x5,%eax
    14a4:	0f 85 dd 00 00 00    	jne    1587 <linktest+0x1d7>
    printf(1, "read lf2 failed\n");
    exit();
  }
  close(fd);
    14aa:	89 1c 24             	mov    %ebx,(%esp)
    14ad:	e8 7a 18 00 00       	call   2d2c <close>

  if(link("lf2", "lf2") >= 0){
    14b2:	c7 44 24 04 ea 35 00 	movl   $0x35ea,0x4(%esp)
    14b9:	00 
    14ba:	c7 04 24 ea 35 00 00 	movl   $0x35ea,(%esp)
    14c1:	e8 9e 18 00 00       	call   2d64 <link>
    14c6:	85 c0                	test   %eax,%eax
    14c8:	0f 89 a0 00 00 00    	jns    156e <linktest+0x1be>
    printf(1, "link lf2 lf2 succeeded! oops\n");
    exit();
  }

  unlink("lf2");
    14ce:	c7 04 24 ea 35 00 00 	movl   $0x35ea,(%esp)
    14d5:	e8 7a 18 00 00       	call   2d54 <unlink>
  if(link("lf2", "lf1") >= 0){
    14da:	c7 44 24 04 e6 35 00 	movl   $0x35e6,0x4(%esp)
    14e1:	00 
    14e2:	c7 04 24 ea 35 00 00 	movl   $0x35ea,(%esp)
    14e9:	e8 76 18 00 00       	call   2d64 <link>
    14ee:	85 c0                	test   %eax,%eax
    14f0:	79 63                	jns    1555 <linktest+0x1a5>
    printf(1, "link non-existant succeeded! oops\n");
    exit();
  }

  if(link(".", "lf1") >= 0){
    14f2:	c7 44 24 04 e6 35 00 	movl   $0x35e6,0x4(%esp)
    14f9:	00 
    14fa:	c7 04 24 8a 38 00 00 	movl   $0x388a,(%esp)
    1501:	e8 5e 18 00 00       	call   2d64 <link>
    1506:	85 c0                	test   %eax,%eax
    1508:	79 32                	jns    153c <linktest+0x18c>
    printf(1, "link . lf1 succeeded! oops\n");
    exit();
  }

  printf(1, "linktest ok\n");
    150a:	c7 44 24 04 84 36 00 	movl   $0x3684,0x4(%esp)
    1511:	00 
    1512:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1519:	e8 32 19 00 00       	call   2e50 <printf>
}
    151e:	83 c4 18             	add    $0x18,%esp
    1521:	5b                   	pop    %ebx
    1522:	c3                   	ret    
  unlink("lf1");
  unlink("lf2");

  fd = open("lf1", O_CREATE|O_RDWR);
  if(fd < 0){
    printf(1, "create lf1 failed\n");
    1523:	c7 44 24 04 ee 35 00 	movl   $0x35ee,0x4(%esp)
    152a:	00 
    152b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1532:	e8 19 19 00 00       	call   2e50 <printf>
    exit();
    1537:	e8 c8 17 00 00       	call   2d04 <exit>
    printf(1, "link non-existant succeeded! oops\n");
    exit();
  }

  if(link(".", "lf1") >= 0){
    printf(1, "link . lf1 succeeded! oops\n");
    153c:	c7 44 24 04 68 36 00 	movl   $0x3668,0x4(%esp)
    1543:	00 
    1544:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    154b:	e8 00 19 00 00       	call   2e50 <printf>
    exit();
    1550:	e8 af 17 00 00       	call   2d04 <exit>
    exit();
  }

  unlink("lf2");
  if(link("lf2", "lf1") >= 0){
    printf(1, "link non-existant succeeded! oops\n");
    1555:	c7 44 24 04 98 3f 00 	movl   $0x3f98,0x4(%esp)
    155c:	00 
    155d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1564:	e8 e7 18 00 00       	call   2e50 <printf>
    exit();
    1569:	e8 96 17 00 00       	call   2d04 <exit>
    exit();
  }
  close(fd);

  if(link("lf2", "lf2") >= 0){
    printf(1, "link lf2 lf2 succeeded! oops\n");
    156e:	c7 44 24 04 4a 36 00 	movl   $0x364a,0x4(%esp)
    1575:	00 
    1576:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    157d:	e8 ce 18 00 00       	call   2e50 <printf>
    exit();
    1582:	e8 7d 17 00 00       	call   2d04 <exit>
  if(fd < 0){
    printf(1, "open lf2 failed\n");
    exit();
  }
  if(read(fd, buf, sizeof(buf)) != 5){
    printf(1, "read lf2 failed\n");
    1587:	c7 44 24 04 39 36 00 	movl   $0x3639,0x4(%esp)
    158e:	00 
    158f:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1596:	e8 b5 18 00 00       	call   2e50 <printf>
    exit();
    159b:	e8 64 17 00 00       	call   2d04 <exit>
    exit();
  }

  fd = open("lf2", 0);
  if(fd < 0){
    printf(1, "open lf2 failed\n");
    15a0:	c7 44 24 04 28 36 00 	movl   $0x3628,0x4(%esp)
    15a7:	00 
    15a8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    15af:	e8 9c 18 00 00       	call   2e50 <printf>
    exit();
    15b4:	e8 4b 17 00 00       	call   2d04 <exit>
    exit();
  }
  unlink("lf1");

  if(open("lf1", 0) >= 0){
    printf(1, "unlinked lf1 but it is still there!\n");
    15b9:	c7 44 24 04 70 3f 00 	movl   $0x3f70,0x4(%esp)
    15c0:	00 
    15c1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    15c8:	e8 83 18 00 00       	call   2e50 <printf>
    exit();
    15cd:	e8 32 17 00 00       	call   2d04 <exit>
    exit();
  }
  close(fd);

  if(link("lf1", "lf2") < 0){
    printf(1, "link lf1 lf2 failed\n");
    15d2:	c7 44 24 04 13 36 00 	movl   $0x3613,0x4(%esp)
    15d9:	00 
    15da:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    15e1:	e8 6a 18 00 00       	call   2e50 <printf>
    exit();
    15e6:	e8 19 17 00 00       	call   2d04 <exit>
  if(fd < 0){
    printf(1, "create lf1 failed\n");
    exit();
  }
  if(write(fd, "hello", 5) != 5){
    printf(1, "write lf1 failed\n");
    15eb:	c7 44 24 04 01 36 00 	movl   $0x3601,0x4(%esp)
    15f2:	00 
    15f3:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    15fa:	e8 51 18 00 00       	call   2e50 <printf>
    exit();
    15ff:	e8 00 17 00 00       	call   2d04 <exit>
    1604:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    160a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00001610 <concreate>:
}

// test concurrent create and unlink of the same file
void
concreate(void)
{
    1610:	55                   	push   %ebp
    file[1] = '0' + i;
    unlink(file);
    pid = fork();
    if(pid && (i % 3) == 1){
      link("C0", file);
    } else if(pid == 0 && (i % 5) == 1){
    1611:	bd 67 66 66 66       	mov    $0x66666667,%ebp
}

// test concurrent create and unlink of the same file
void
concreate(void)
{
    1616:	57                   	push   %edi
    1617:	56                   	push   %esi
    1618:	53                   	push   %ebx
  } de;

  printf(1, "concreate test\n");
  file[0] = 'C';
  file[2] = '\0';
  for(i = 0; i < 40; i++){
    1619:	31 db                	xor    %ebx,%ebx
}

// test concurrent create and unlink of the same file
void
concreate(void)
{
    161b:	83 ec 5c             	sub    $0x5c,%esp
  struct {
    ushort inum;
    char name[14];
  } de;

  printf(1, "concreate test\n");
    161e:	c7 44 24 04 91 36 00 	movl   $0x3691,0x4(%esp)
    1625:	00 
    1626:	8d 7c 24 4d          	lea    0x4d(%esp),%edi
    162a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1631:	e8 1a 18 00 00       	call   2e50 <printf>
  file[0] = 'C';
    1636:	c6 44 24 4d 43       	movb   $0x43,0x4d(%esp)
  file[2] = '\0';
    163b:	c6 44 24 4f 00       	movb   $0x0,0x4f(%esp)
    1640:	eb 51                	jmp    1693 <concreate+0x83>
    1642:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  for(i = 0; i < 40; i++){
    file[1] = '0' + i;
    unlink(file);
    pid = fork();
    if(pid && (i % 3) == 1){
    1648:	b8 56 55 55 55       	mov    $0x55555556,%eax
    164d:	f7 eb                	imul   %ebx
    164f:	89 d8                	mov    %ebx,%eax
    1651:	c1 f8 1f             	sar    $0x1f,%eax
    1654:	29 c2                	sub    %eax,%edx
    1656:	8d 04 52             	lea    (%edx,%edx,2),%eax
    1659:	89 da                	mov    %ebx,%edx
    165b:	29 c2                	sub    %eax,%edx
    165d:	83 fa 01             	cmp    $0x1,%edx
    1660:	74 7e                	je     16e0 <concreate+0xd0>
      link("C0", file);
    } else if(pid == 0 && (i % 5) == 1){
      link("C0", file);
    } else {
      fd = open(file, O_CREATE | O_RDWR);
    1662:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
    1669:	00 
    166a:	89 3c 24             	mov    %edi,(%esp)
    166d:	e8 d2 16 00 00       	call   2d44 <open>
      if(fd < 0){
    1672:	85 c0                	test   %eax,%eax
    1674:	0f 88 db 01 00 00    	js     1855 <concreate+0x245>
        printf(1, "concreate create %s failed\n", file);
        exit();
      }
      close(fd);
    167a:	89 04 24             	mov    %eax,(%esp)
    167d:	e8 aa 16 00 00       	call   2d2c <close>
    }
    if(pid == 0)
    1682:	85 f6                	test   %esi,%esi
    1684:	74 50                	je     16d6 <concreate+0xc6>
  } de;

  printf(1, "concreate test\n");
  file[0] = 'C';
  file[2] = '\0';
  for(i = 0; i < 40; i++){
    1686:	83 c3 01             	add    $0x1,%ebx
      close(fd);
    }
    if(pid == 0)
      exit();
    else
      wait();
    1689:	e8 7e 16 00 00       	call   2d0c <wait>
  } de;

  printf(1, "concreate test\n");
  file[0] = 'C';
  file[2] = '\0';
  for(i = 0; i < 40; i++){
    168e:	83 fb 28             	cmp    $0x28,%ebx
    1691:	74 6d                	je     1700 <concreate+0xf0>
  printf(1, "linktest ok\n");
}

// test concurrent create and unlink of the same file
void
concreate(void)
    1693:	8d 43 30             	lea    0x30(%ebx),%eax
    1696:	88 44 24 4e          	mov    %al,0x4e(%esp)
  printf(1, "concreate test\n");
  file[0] = 'C';
  file[2] = '\0';
  for(i = 0; i < 40; i++){
    file[1] = '0' + i;
    unlink(file);
    169a:	89 3c 24             	mov    %edi,(%esp)
    169d:	e8 b2 16 00 00       	call   2d54 <unlink>
    pid = fork();
    16a2:	e8 55 16 00 00       	call   2cfc <fork>
    if(pid && (i % 3) == 1){
    16a7:	85 c0                	test   %eax,%eax
  file[0] = 'C';
  file[2] = '\0';
  for(i = 0; i < 40; i++){
    file[1] = '0' + i;
    unlink(file);
    pid = fork();
    16a9:	89 c6                	mov    %eax,%esi
    if(pid && (i % 3) == 1){
    16ab:	75 9b                	jne    1648 <concreate+0x38>
      link("C0", file);
    } else if(pid == 0 && (i % 5) == 1){
    16ad:	89 d8                	mov    %ebx,%eax
    16af:	f7 ed                	imul   %ebp
    16b1:	89 d8                	mov    %ebx,%eax
    16b3:	c1 f8 1f             	sar    $0x1f,%eax
    16b6:	d1 fa                	sar    %edx
    16b8:	29 c2                	sub    %eax,%edx
    16ba:	8d 04 92             	lea    (%edx,%edx,4),%eax
    16bd:	89 da                	mov    %ebx,%edx
    16bf:	29 c2                	sub    %eax,%edx
    16c1:	83 fa 01             	cmp    $0x1,%edx
    16c4:	75 9c                	jne    1662 <concreate+0x52>
      link("C0", file);
    16c6:	89 7c 24 04          	mov    %edi,0x4(%esp)
    16ca:	c7 04 24 a1 36 00 00 	movl   $0x36a1,(%esp)
    16d1:	e8 8e 16 00 00       	call   2d64 <link>
      continue;
    if(de.name[0] == 'C' && de.name[2] == '\0'){
      i = de.name[1] - '0';
      if(i < 0 || i >= sizeof(fa)){
        printf(1, "concreate weird file %s\n", de.name);
        exit();
    16d6:	e8 29 16 00 00       	call   2d04 <exit>
    16db:	90                   	nop
    16dc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  } de;

  printf(1, "concreate test\n");
  file[0] = 'C';
  file[2] = '\0';
  for(i = 0; i < 40; i++){
    16e0:	83 c3 01             	add    $0x1,%ebx
    file[1] = '0' + i;
    unlink(file);
    pid = fork();
    if(pid && (i % 3) == 1){
      link("C0", file);
    16e3:	89 7c 24 04          	mov    %edi,0x4(%esp)
    16e7:	c7 04 24 a1 36 00 00 	movl   $0x36a1,(%esp)
    16ee:	e8 71 16 00 00       	call   2d64 <link>
      close(fd);
    }
    if(pid == 0)
      exit();
    else
      wait();
    16f3:	e8 14 16 00 00       	call   2d0c <wait>
  } de;

  printf(1, "concreate test\n");
  file[0] = 'C';
  file[2] = '\0';
  for(i = 0; i < 40; i++){
    16f8:	83 fb 28             	cmp    $0x28,%ebx
    16fb:	75 96                	jne    1693 <concreate+0x83>
    16fd:	8d 76 00             	lea    0x0(%esi),%esi
      exit();
    else
      wait();
  }

  memset(fa, 0, sizeof(fa));
    1700:	8d 44 24 14          	lea    0x14(%esp),%eax
  fd = open(".", 0);
  n = 0;
    1704:	31 ed                	xor    %ebp,%ebp
      exit();
    else
      wait();
  }

  memset(fa, 0, sizeof(fa));
    1706:	c7 44 24 08 28 00 00 	movl   $0x28,0x8(%esp)
    170d:	00 
    170e:	8d 74 24 3c          	lea    0x3c(%esp),%esi
    1712:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    1719:	00 
    171a:	89 04 24             	mov    %eax,(%esp)
    171d:	e8 1e 14 00 00       	call   2b40 <memset>
  fd = open(".", 0);
    1722:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    1729:	00 
    172a:	c7 04 24 8a 38 00 00 	movl   $0x388a,(%esp)
    1731:	e8 0e 16 00 00       	call   2d44 <open>
    1736:	89 c3                	mov    %eax,%ebx
  n = 0;
  while(read(fd, &de, sizeof(de)) > 0){
    1738:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
    173f:	00 
    1740:	89 74 24 04          	mov    %esi,0x4(%esp)
    1744:	89 1c 24             	mov    %ebx,(%esp)
    1747:	e8 d0 15 00 00       	call   2d1c <read>
    174c:	85 c0                	test   %eax,%eax
    174e:	7e 40                	jle    1790 <concreate+0x180>
    if(de.inum == 0)
    1750:	66 83 7c 24 3c 00    	cmpw   $0x0,0x3c(%esp)
    1756:	74 e0                	je     1738 <concreate+0x128>
      continue;
    if(de.name[0] == 'C' && de.name[2] == '\0'){
    1758:	80 7c 24 3e 43       	cmpb   $0x43,0x3e(%esp)
    175d:	75 d9                	jne    1738 <concreate+0x128>
    175f:	80 7c 24 40 00       	cmpb   $0x0,0x40(%esp)
    1764:	75 d2                	jne    1738 <concreate+0x128>
      i = de.name[1] - '0';
    1766:	0f be 44 24 3f       	movsbl 0x3f(%esp),%eax
    176b:	83 e8 30             	sub    $0x30,%eax
      if(i < 0 || i >= sizeof(fa)){
    176e:	83 f8 27             	cmp    $0x27,%eax
    1771:	0f 87 fb 00 00 00    	ja     1872 <concreate+0x262>
        printf(1, "concreate weird file %s\n", de.name);
        exit();
      }
      if(fa[i]){
    1777:	80 7c 04 14 00       	cmpb   $0x0,0x14(%esp,%eax,1)
    177c:	0f 85 2a 01 00 00    	jne    18ac <concreate+0x29c>
        printf(1, "concreate duplicate file %s\n", de.name);
        exit();
      }
      fa[i] = 1;
    1782:	c6 44 04 14 01       	movb   $0x1,0x14(%esp,%eax,1)
      n++;
    1787:	83 c5 01             	add    $0x1,%ebp
    178a:	eb ac                	jmp    1738 <concreate+0x128>
    178c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    }
  }
  close(fd);
    1790:	89 1c 24             	mov    %ebx,(%esp)
    1793:	e8 94 15 00 00       	call   2d2c <close>

  if(n != 40){
    1798:	83 fd 28             	cmp    $0x28,%ebp
    179b:	0f 85 f2 00 00 00    	jne    1893 <concreate+0x283>
    17a1:	31 db                	xor    %ebx,%ebx
    pid = fork();
    if(pid < 0){
      printf(1, "fork failed\n");
      exit();
    }
    if(((i % 3) == 0 && pid == 0) ||
    17a3:	bd 56 55 55 55       	mov    $0x55555556,%ebp
    17a8:	eb 37                	jmp    17e1 <concreate+0x1d1>
    17aa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    17b0:	85 f6                	test   %esi,%esi
    17b2:	74 5c                	je     1810 <concreate+0x200>
       ((i % 3) == 1 && pid != 0)){
      fd = open(file, 0);
    17b4:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    17bb:	00 
    17bc:	89 3c 24             	mov    %edi,(%esp)
    17bf:	e8 80 15 00 00       	call   2d44 <open>
      close(fd);
    17c4:	89 04 24             	mov    %eax,(%esp)
    17c7:	e8 60 15 00 00       	call   2d2c <close>
    } else {
      unlink(file);
    }
    if(pid == 0)
    17cc:	85 f6                	test   %esi,%esi
    17ce:	0f 84 02 ff ff ff    	je     16d6 <concreate+0xc6>
  if(n != 40){
    printf(1, "concreate not enough files in directory listing\n");
    exit();
  }

  for(i = 0; i < 40; i++){
    17d4:	83 c3 01             	add    $0x1,%ebx
      unlink(file);
    }
    if(pid == 0)
      exit();
    else
      wait();
    17d7:	e8 30 15 00 00       	call   2d0c <wait>
  if(n != 40){
    printf(1, "concreate not enough files in directory listing\n");
    exit();
  }

  for(i = 0; i < 40; i++){
    17dc:	83 fb 28             	cmp    $0x28,%ebx
    17df:	74 3f                	je     1820 <concreate+0x210>
  printf(1, "linktest ok\n");
}

// test concurrent create and unlink of the same file
void
concreate(void)
    17e1:	8d 43 30             	lea    0x30(%ebx),%eax
    17e4:	88 44 24 4e          	mov    %al,0x4e(%esp)
    exit();
  }

  for(i = 0; i < 40; i++){
    file[1] = '0' + i;
    pid = fork();
    17e8:	e8 0f 15 00 00       	call   2cfc <fork>
    if(pid < 0){
    17ed:	85 c0                	test   %eax,%eax
    exit();
  }

  for(i = 0; i < 40; i++){
    file[1] = '0' + i;
    pid = fork();
    17ef:	89 c6                	mov    %eax,%esi
    if(pid < 0){
    17f1:	78 49                	js     183c <concreate+0x22c>
      printf(1, "fork failed\n");
      exit();
    }
    if(((i % 3) == 0 && pid == 0) ||
    17f3:	89 d8                	mov    %ebx,%eax
    17f5:	f7 ed                	imul   %ebp
    17f7:	89 d8                	mov    %ebx,%eax
    17f9:	c1 f8 1f             	sar    $0x1f,%eax
    17fc:	29 c2                	sub    %eax,%edx
    17fe:	8d 04 52             	lea    (%edx,%edx,2),%eax
    1801:	89 da                	mov    %ebx,%edx
    1803:	29 c2                	sub    %eax,%edx
    1805:	89 d0                	mov    %edx,%eax
    1807:	09 f0                	or     %esi,%eax
    1809:	74 a9                	je     17b4 <concreate+0x1a4>
    180b:	83 fa 01             	cmp    $0x1,%edx
    180e:	74 a0                	je     17b0 <concreate+0x1a0>
       ((i % 3) == 1 && pid != 0)){
      fd = open(file, 0);
      close(fd);
    } else {
      unlink(file);
    1810:	89 3c 24             	mov    %edi,(%esp)
    1813:	e8 3c 15 00 00       	call   2d54 <unlink>
    1818:	eb b2                	jmp    17cc <concreate+0x1bc>
    181a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
      exit();
    else
      wait();
  }

  printf(1, "concreate ok\n");
    1820:	c7 44 24 04 f6 36 00 	movl   $0x36f6,0x4(%esp)
    1827:	00 
    1828:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    182f:	e8 1c 16 00 00       	call   2e50 <printf>
}
    1834:	83 c4 5c             	add    $0x5c,%esp
    1837:	5b                   	pop    %ebx
    1838:	5e                   	pop    %esi
    1839:	5f                   	pop    %edi
    183a:	5d                   	pop    %ebp
    183b:	c3                   	ret    

  for(i = 0; i < 40; i++){
    file[1] = '0' + i;
    pid = fork();
    if(pid < 0){
      printf(1, "fork failed\n");
    183c:	c7 44 24 04 20 34 00 	movl   $0x3420,0x4(%esp)
    1843:	00 
    1844:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    184b:	e8 00 16 00 00       	call   2e50 <printf>
      exit();
    1850:	e8 af 14 00 00       	call   2d04 <exit>
    } else if(pid == 0 && (i % 5) == 1){
      link("C0", file);
    } else {
      fd = open(file, O_CREATE | O_RDWR);
      if(fd < 0){
        printf(1, "concreate create %s failed\n", file);
    1855:	89 7c 24 08          	mov    %edi,0x8(%esp)
    1859:	c7 44 24 04 a4 36 00 	movl   $0x36a4,0x4(%esp)
    1860:	00 
    1861:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1868:	e8 e3 15 00 00       	call   2e50 <printf>
        exit();
    186d:	e8 92 14 00 00       	call   2d04 <exit>
    if(de.inum == 0)
      continue;
    if(de.name[0] == 'C' && de.name[2] == '\0'){
      i = de.name[1] - '0';
      if(i < 0 || i >= sizeof(fa)){
        printf(1, "concreate weird file %s\n", de.name);
    1872:	8d 44 24 3e          	lea    0x3e(%esp),%eax
    1876:	89 44 24 08          	mov    %eax,0x8(%esp)
    187a:	c7 44 24 04 c0 36 00 	movl   $0x36c0,0x4(%esp)
    1881:	00 
    1882:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1889:	e8 c2 15 00 00       	call   2e50 <printf>
    188e:	e9 43 fe ff ff       	jmp    16d6 <concreate+0xc6>
    }
  }
  close(fd);

  if(n != 40){
    printf(1, "concreate not enough files in directory listing\n");
    1893:	c7 44 24 04 bc 3f 00 	movl   $0x3fbc,0x4(%esp)
    189a:	00 
    189b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    18a2:	e8 a9 15 00 00       	call   2e50 <printf>
    exit();
    18a7:	e8 58 14 00 00       	call   2d04 <exit>
      if(i < 0 || i >= sizeof(fa)){
        printf(1, "concreate weird file %s\n", de.name);
        exit();
      }
      if(fa[i]){
        printf(1, "concreate duplicate file %s\n", de.name);
    18ac:	8d 44 24 3e          	lea    0x3e(%esp),%eax
    18b0:	89 44 24 08          	mov    %eax,0x8(%esp)
    18b4:	c7 44 24 04 d9 36 00 	movl   $0x36d9,0x4(%esp)
    18bb:	00 
    18bc:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    18c3:	e8 88 15 00 00       	call   2e50 <printf>
        exit();
    18c8:	e8 37 14 00 00       	call   2d04 <exit>
    18cd:	8d 76 00             	lea    0x0(%esi),%esi

000018d0 <bigdir>:
}

// directory that uses indirect blocks
void
bigdir(void)
{
    18d0:	56                   	push   %esi
    18d1:	53                   	push   %ebx
    18d2:	83 ec 24             	sub    $0x24,%esp
  int i, fd;
  char name[10];

  printf(1, "bigdir test\n");
    18d5:	c7 44 24 04 04 37 00 	movl   $0x3704,0x4(%esp)
    18dc:	00 
    18dd:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    18e4:	e8 67 15 00 00       	call   2e50 <printf>
  unlink("bd");
    18e9:	c7 04 24 11 37 00 00 	movl   $0x3711,(%esp)
    18f0:	e8 5f 14 00 00       	call   2d54 <unlink>

  fd = open("bd", O_CREATE);
    18f5:	c7 44 24 04 00 02 00 	movl   $0x200,0x4(%esp)
    18fc:	00 
    18fd:	c7 04 24 11 37 00 00 	movl   $0x3711,(%esp)
    1904:	e8 3b 14 00 00       	call   2d44 <open>
  if(fd < 0){
    1909:	85 c0                	test   %eax,%eax
    190b:	0f 88 e4 00 00 00    	js     19f5 <bigdir+0x125>
    printf(1, "bigdir create failed\n");
    exit();
  }
  close(fd);
    1911:	89 04 24             	mov    %eax,(%esp)

  for(i = 0; i < 500; i++){
    1914:	31 db                	xor    %ebx,%ebx
  fd = open("bd", O_CREATE);
  if(fd < 0){
    printf(1, "bigdir create failed\n");
    exit();
  }
  close(fd);
    1916:	e8 11 14 00 00       	call   2d2c <close>
    191b:	8d 74 24 16          	lea    0x16(%esp),%esi
    191f:	90                   	nop

  for(i = 0; i < 500; i++){
    name[0] = 'x';
    name[1] = '0' + (i / 64);
    1920:	89 d8                	mov    %ebx,%eax
    1922:	c1 f8 06             	sar    $0x6,%eax
    1925:	83 c0 30             	add    $0x30,%eax
    1928:	88 44 24 17          	mov    %al,0x17(%esp)
    name[2] = '0' + (i % 64);
    192c:	89 d8                	mov    %ebx,%eax
    192e:	83 e0 3f             	and    $0x3f,%eax
    1931:	83 c0 30             	add    $0x30,%eax
    exit();
  }
  close(fd);

  for(i = 0; i < 500; i++){
    name[0] = 'x';
    1934:	c6 44 24 16 78       	movb   $0x78,0x16(%esp)
    name[1] = '0' + (i / 64);
    name[2] = '0' + (i % 64);
    1939:	88 44 24 18          	mov    %al,0x18(%esp)
    name[3] = '\0';
    193d:	c6 44 24 19 00       	movb   $0x0,0x19(%esp)
    if(link("bd", name) != 0){
    1942:	89 74 24 04          	mov    %esi,0x4(%esp)
    1946:	c7 04 24 11 37 00 00 	movl   $0x3711,(%esp)
    194d:	e8 12 14 00 00       	call   2d64 <link>
    1952:	85 c0                	test   %eax,%eax
    1954:	75 6d                	jne    19c3 <bigdir+0xf3>
    printf(1, "bigdir create failed\n");
    exit();
  }
  close(fd);

  for(i = 0; i < 500; i++){
    1956:	83 c3 01             	add    $0x1,%ebx
    1959:	81 fb f4 01 00 00    	cmp    $0x1f4,%ebx
    195f:	75 bf                	jne    1920 <bigdir+0x50>
      printf(1, "bigdir link failed\n");
      exit();
    }
  }

  unlink("bd");
    1961:	c7 04 24 11 37 00 00 	movl   $0x3711,(%esp)
  for(i = 0; i < 500; i++){
    1968:	66 31 db             	xor    %bx,%bx
      printf(1, "bigdir link failed\n");
      exit();
    }
  }

  unlink("bd");
    196b:	e8 e4 13 00 00       	call   2d54 <unlink>
  for(i = 0; i < 500; i++){
    name[0] = 'x';
    name[1] = '0' + (i / 64);
    1970:	89 d8                	mov    %ebx,%eax
    1972:	c1 f8 06             	sar    $0x6,%eax
    1975:	83 c0 30             	add    $0x30,%eax
    1978:	88 44 24 17          	mov    %al,0x17(%esp)
    name[2] = '0' + (i % 64);
    197c:	89 d8                	mov    %ebx,%eax
    197e:	83 e0 3f             	and    $0x3f,%eax
    1981:	83 c0 30             	add    $0x30,%eax
    }
  }

  unlink("bd");
  for(i = 0; i < 500; i++){
    name[0] = 'x';
    1984:	c6 44 24 16 78       	movb   $0x78,0x16(%esp)
    name[1] = '0' + (i / 64);
    name[2] = '0' + (i % 64);
    1989:	88 44 24 18          	mov    %al,0x18(%esp)
    name[3] = '\0';
    198d:	c6 44 24 19 00       	movb   $0x0,0x19(%esp)
    if(unlink(name) != 0){
    1992:	89 34 24             	mov    %esi,(%esp)
    1995:	e8 ba 13 00 00       	call   2d54 <unlink>
    199a:	85 c0                	test   %eax,%eax
    199c:	75 3e                	jne    19dc <bigdir+0x10c>
      exit();
    }
  }

  unlink("bd");
  for(i = 0; i < 500; i++){
    199e:	83 c3 01             	add    $0x1,%ebx
    19a1:	81 fb f4 01 00 00    	cmp    $0x1f4,%ebx
    19a7:	75 c7                	jne    1970 <bigdir+0xa0>
      printf(1, "bigdir unlink failed");
      exit();
    }
  }

  printf(1, "bigdir ok\n");
    19a9:	c7 44 24 04 53 37 00 	movl   $0x3753,0x4(%esp)
    19b0:	00 
    19b1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    19b8:	e8 93 14 00 00       	call   2e50 <printf>
}
    19bd:	83 c4 24             	add    $0x24,%esp
    19c0:	5b                   	pop    %ebx
    19c1:	5e                   	pop    %esi
    19c2:	c3                   	ret    
    name[0] = 'x';
    name[1] = '0' + (i / 64);
    name[2] = '0' + (i % 64);
    name[3] = '\0';
    if(link("bd", name) != 0){
      printf(1, "bigdir link failed\n");
    19c3:	c7 44 24 04 2a 37 00 	movl   $0x372a,0x4(%esp)
    19ca:	00 
    19cb:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    19d2:	e8 79 14 00 00       	call   2e50 <printf>
      exit();
    19d7:	e8 28 13 00 00       	call   2d04 <exit>
    name[0] = 'x';
    name[1] = '0' + (i / 64);
    name[2] = '0' + (i % 64);
    name[3] = '\0';
    if(unlink(name) != 0){
      printf(1, "bigdir unlink failed");
    19dc:	c7 44 24 04 3e 37 00 	movl   $0x373e,0x4(%esp)
    19e3:	00 
    19e4:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    19eb:	e8 60 14 00 00       	call   2e50 <printf>
      exit();
    19f0:	e8 0f 13 00 00       	call   2d04 <exit>
  printf(1, "bigdir test\n");
  unlink("bd");

  fd = open("bd", O_CREATE);
  if(fd < 0){
    printf(1, "bigdir create failed\n");
    19f5:	c7 44 24 04 14 37 00 	movl   $0x3714,0x4(%esp)
    19fc:	00 
    19fd:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1a04:	e8 47 14 00 00       	call   2e50 <printf>
    exit();
    1a09:	e8 f6 12 00 00       	call   2d04 <exit>
    1a0e:	66 90                	xchg   %ax,%ax

00001a10 <subdir>:
  printf(1, "bigdir ok\n");
}

void
subdir(void)
{
    1a10:	53                   	push   %ebx
    1a11:	83 ec 18             	sub    $0x18,%esp
  int fd, cc;

  printf(1, "subdir test\n");
    1a14:	c7 44 24 04 5e 37 00 	movl   $0x375e,0x4(%esp)
    1a1b:	00 
    1a1c:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1a23:	e8 28 14 00 00       	call   2e50 <printf>

  unlink("ff");
    1a28:	c7 04 24 e7 37 00 00 	movl   $0x37e7,(%esp)
    1a2f:	e8 20 13 00 00       	call   2d54 <unlink>
  if(mkdir("dd") != 0){
    1a34:	c7 04 24 84 38 00 00 	movl   $0x3884,(%esp)
    1a3b:	e8 2c 13 00 00       	call   2d6c <mkdir>
    1a40:	85 c0                	test   %eax,%eax
    1a42:	0f 85 06 06 00 00    	jne    204e <subdir+0x63e>
    printf(1, "subdir mkdir dd failed\n");
    exit();
  }

  fd = open("dd/ff", O_CREATE | O_RDWR);
    1a48:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
    1a4f:	00 
    1a50:	c7 04 24 bd 37 00 00 	movl   $0x37bd,(%esp)
    1a57:	e8 e8 12 00 00       	call   2d44 <open>
  if(fd < 0){
    1a5c:	85 c0                	test   %eax,%eax
  if(mkdir("dd") != 0){
    printf(1, "subdir mkdir dd failed\n");
    exit();
  }

  fd = open("dd/ff", O_CREATE | O_RDWR);
    1a5e:	89 c3                	mov    %eax,%ebx
  if(fd < 0){
    1a60:	0f 88 cf 05 00 00    	js     2035 <subdir+0x625>
    printf(1, "create dd/ff failed\n");
    exit();
  }
  write(fd, "ff", 2);
    1a66:	c7 44 24 08 02 00 00 	movl   $0x2,0x8(%esp)
    1a6d:	00 
    1a6e:	c7 44 24 04 e7 37 00 	movl   $0x37e7,0x4(%esp)
    1a75:	00 
    1a76:	89 04 24             	mov    %eax,(%esp)
    1a79:	e8 a6 12 00 00       	call   2d24 <write>
  close(fd);
    1a7e:	89 1c 24             	mov    %ebx,(%esp)
    1a81:	e8 a6 12 00 00       	call   2d2c <close>
  
  if(unlink("dd") >= 0){
    1a86:	c7 04 24 84 38 00 00 	movl   $0x3884,(%esp)
    1a8d:	e8 c2 12 00 00       	call   2d54 <unlink>
    1a92:	85 c0                	test   %eax,%eax
    1a94:	0f 89 82 05 00 00    	jns    201c <subdir+0x60c>
    printf(1, "unlink dd (non-empty dir) succeeded!\n");
    exit();
  }

  if(mkdir("/dd/dd") != 0){
    1a9a:	c7 04 24 98 37 00 00 	movl   $0x3798,(%esp)
    1aa1:	e8 c6 12 00 00       	call   2d6c <mkdir>
    1aa6:	85 c0                	test   %eax,%eax
    1aa8:	0f 85 55 05 00 00    	jne    2003 <subdir+0x5f3>
    printf(1, "subdir mkdir dd/dd failed\n");
    exit();
  }

  fd = open("dd/dd/ff", O_CREATE | O_RDWR);
    1aae:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
    1ab5:	00 
    1ab6:	c7 04 24 ba 37 00 00 	movl   $0x37ba,(%esp)
    1abd:	e8 82 12 00 00       	call   2d44 <open>
  if(fd < 0){
    1ac2:	85 c0                	test   %eax,%eax
  if(mkdir("/dd/dd") != 0){
    printf(1, "subdir mkdir dd/dd failed\n");
    exit();
  }

  fd = open("dd/dd/ff", O_CREATE | O_RDWR);
    1ac4:	89 c3                	mov    %eax,%ebx
  if(fd < 0){
    1ac6:	0f 88 24 04 00 00    	js     1ef0 <subdir+0x4e0>
    printf(1, "create dd/dd/ff failed\n");
    exit();
  }
  write(fd, "FF", 2);
    1acc:	c7 44 24 08 02 00 00 	movl   $0x2,0x8(%esp)
    1ad3:	00 
    1ad4:	c7 44 24 04 db 37 00 	movl   $0x37db,0x4(%esp)
    1adb:	00 
    1adc:	89 04 24             	mov    %eax,(%esp)
    1adf:	e8 40 12 00 00       	call   2d24 <write>
  close(fd);
    1ae4:	89 1c 24             	mov    %ebx,(%esp)
    1ae7:	e8 40 12 00 00       	call   2d2c <close>

  fd = open("dd/dd/../ff", 0);
    1aec:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    1af3:	00 
    1af4:	c7 04 24 de 37 00 00 	movl   $0x37de,(%esp)
    1afb:	e8 44 12 00 00       	call   2d44 <open>
  if(fd < 0){
    1b00:	85 c0                	test   %eax,%eax
    exit();
  }
  write(fd, "FF", 2);
  close(fd);

  fd = open("dd/dd/../ff", 0);
    1b02:	89 c3                	mov    %eax,%ebx
  if(fd < 0){
    1b04:	0f 88 cd 03 00 00    	js     1ed7 <subdir+0x4c7>
    printf(1, "open dd/dd/../ff failed\n");
    exit();
  }
  cc = read(fd, buf, sizeof(buf));
    1b0a:	c7 44 24 08 00 08 00 	movl   $0x800,0x8(%esp)
    1b11:	00 
    1b12:	c7 44 24 04 e0 4a 00 	movl   $0x4ae0,0x4(%esp)
    1b19:	00 
    1b1a:	89 04 24             	mov    %eax,(%esp)
    1b1d:	e8 fa 11 00 00       	call   2d1c <read>
  if(cc != 2 || buf[0] != 'f'){
    1b22:	83 f8 02             	cmp    $0x2,%eax
    1b25:	0f 85 fd 02 00 00    	jne    1e28 <subdir+0x418>
    1b2b:	80 3d e0 4a 00 00 66 	cmpb   $0x66,0x4ae0
    1b32:	0f 85 f0 02 00 00    	jne    1e28 <subdir+0x418>
    printf(1, "dd/dd/../ff wrong content\n");
    exit();
  }
  close(fd);
    1b38:	89 1c 24             	mov    %ebx,(%esp)
    1b3b:	e8 ec 11 00 00       	call   2d2c <close>

  if(link("dd/dd/ff", "dd/dd/ffff") != 0){
    1b40:	c7 44 24 04 1e 38 00 	movl   $0x381e,0x4(%esp)
    1b47:	00 
    1b48:	c7 04 24 ba 37 00 00 	movl   $0x37ba,(%esp)
    1b4f:	e8 10 12 00 00       	call   2d64 <link>
    1b54:	85 c0                	test   %eax,%eax
    1b56:	0f 85 c6 03 00 00    	jne    1f22 <subdir+0x512>
    printf(1, "link dd/dd/ff dd/dd/ffff failed\n");
    exit();
  }

  if(unlink("dd/dd/ff") != 0){
    1b5c:	c7 04 24 ba 37 00 00 	movl   $0x37ba,(%esp)
    1b63:	e8 ec 11 00 00       	call   2d54 <unlink>
    1b68:	85 c0                	test   %eax,%eax
    1b6a:	0f 85 ea 02 00 00    	jne    1e5a <subdir+0x44a>
    printf(1, "unlink dd/dd/ff failed\n");
    exit();
  }
  if(open("dd/dd/ff", O_RDONLY) >= 0){
    1b70:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    1b77:	00 
    1b78:	c7 04 24 ba 37 00 00 	movl   $0x37ba,(%esp)
    1b7f:	e8 c0 11 00 00       	call   2d44 <open>
    1b84:	85 c0                	test   %eax,%eax
    1b86:	0f 89 5e 04 00 00    	jns    1fea <subdir+0x5da>
    printf(1, "open (unlinked) dd/dd/ff succeeded\n");
    exit();
  }

  if(chdir("dd") != 0){
    1b8c:	c7 04 24 84 38 00 00 	movl   $0x3884,(%esp)
    1b93:	e8 dc 11 00 00       	call   2d74 <chdir>
    1b98:	85 c0                	test   %eax,%eax
    1b9a:	0f 85 31 04 00 00    	jne    1fd1 <subdir+0x5c1>
    printf(1, "chdir dd failed\n");
    exit();
  }
  if(chdir("dd/../../dd") != 0){
    1ba0:	c7 04 24 52 38 00 00 	movl   $0x3852,(%esp)
    1ba7:	e8 c8 11 00 00       	call   2d74 <chdir>
    1bac:	85 c0                	test   %eax,%eax
    1bae:	0f 85 8d 02 00 00    	jne    1e41 <subdir+0x431>
    printf(1, "chdir dd/../../dd failed\n");
    exit();
  }
  if(chdir("dd/../../../dd") != 0){
    1bb4:	c7 04 24 78 38 00 00 	movl   $0x3878,(%esp)
    1bbb:	e8 b4 11 00 00       	call   2d74 <chdir>
    1bc0:	85 c0                	test   %eax,%eax
    1bc2:	0f 85 79 02 00 00    	jne    1e41 <subdir+0x431>
    printf(1, "chdir dd/../../dd failed\n");
    exit();
  }
  if(chdir("./..") != 0){
    1bc8:	c7 04 24 87 38 00 00 	movl   $0x3887,(%esp)
    1bcf:	e8 a0 11 00 00       	call   2d74 <chdir>
    1bd4:	85 c0                	test   %eax,%eax
    1bd6:	0f 85 2d 03 00 00    	jne    1f09 <subdir+0x4f9>
    printf(1, "chdir ./.. failed\n");
    exit();
  }

  fd = open("dd/dd/ffff", 0);
    1bdc:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    1be3:	00 
    1be4:	c7 04 24 1e 38 00 00 	movl   $0x381e,(%esp)
    1beb:	e8 54 11 00 00       	call   2d44 <open>
  if(fd < 0){
    1bf0:	85 c0                	test   %eax,%eax
  if(chdir("./..") != 0){
    printf(1, "chdir ./.. failed\n");
    exit();
  }

  fd = open("dd/dd/ffff", 0);
    1bf2:	89 c3                	mov    %eax,%ebx
  if(fd < 0){
    1bf4:	0f 88 80 05 00 00    	js     217a <subdir+0x76a>
    printf(1, "open dd/dd/ffff failed\n");
    exit();
  }
  if(read(fd, buf, sizeof(buf)) != 2){
    1bfa:	c7 44 24 08 00 08 00 	movl   $0x800,0x8(%esp)
    1c01:	00 
    1c02:	c7 44 24 04 e0 4a 00 	movl   $0x4ae0,0x4(%esp)
    1c09:	00 
    1c0a:	89 04 24             	mov    %eax,(%esp)
    1c0d:	e8 0a 11 00 00       	call   2d1c <read>
    1c12:	83 f8 02             	cmp    $0x2,%eax
    1c15:	0f 85 46 05 00 00    	jne    2161 <subdir+0x751>
    printf(1, "read dd/dd/ffff wrong len\n");
    exit();
  }
  close(fd);
    1c1b:	89 1c 24             	mov    %ebx,(%esp)
    1c1e:	e8 09 11 00 00       	call   2d2c <close>

  if(open("dd/dd/ff", O_RDONLY) >= 0){
    1c23:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    1c2a:	00 
    1c2b:	c7 04 24 ba 37 00 00 	movl   $0x37ba,(%esp)
    1c32:	e8 0d 11 00 00       	call   2d44 <open>
    1c37:	85 c0                	test   %eax,%eax
    1c39:	0f 89 4d 02 00 00    	jns    1e8c <subdir+0x47c>
    printf(1, "open (unlinked) dd/dd/ff succeeded!\n");
    exit();
  }

  if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){
    1c3f:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
    1c46:	00 
    1c47:	c7 04 24 d2 38 00 00 	movl   $0x38d2,(%esp)
    1c4e:	e8 f1 10 00 00       	call   2d44 <open>
    1c53:	85 c0                	test   %eax,%eax
    1c55:	0f 89 18 02 00 00    	jns    1e73 <subdir+0x463>
    printf(1, "create dd/ff/ff succeeded!\n");
    exit();
  }
  if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){
    1c5b:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
    1c62:	00 
    1c63:	c7 04 24 f7 38 00 00 	movl   $0x38f7,(%esp)
    1c6a:	e8 d5 10 00 00       	call   2d44 <open>
    1c6f:	85 c0                	test   %eax,%eax
    1c71:	0f 89 41 03 00 00    	jns    1fb8 <subdir+0x5a8>
    printf(1, "create dd/xx/ff succeeded!\n");
    exit();
  }
  if(open("dd", O_CREATE) >= 0){
    1c77:	c7 44 24 04 00 02 00 	movl   $0x200,0x4(%esp)
    1c7e:	00 
    1c7f:	c7 04 24 84 38 00 00 	movl   $0x3884,(%esp)
    1c86:	e8 b9 10 00 00       	call   2d44 <open>
    1c8b:	85 c0                	test   %eax,%eax
    1c8d:	0f 89 0c 03 00 00    	jns    1f9f <subdir+0x58f>
    printf(1, "create dd succeeded!\n");
    exit();
  }
  if(open("dd", O_RDWR) >= 0){
    1c93:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
    1c9a:	00 
    1c9b:	c7 04 24 84 38 00 00 	movl   $0x3884,(%esp)
    1ca2:	e8 9d 10 00 00       	call   2d44 <open>
    1ca7:	85 c0                	test   %eax,%eax
    1ca9:	0f 89 d7 02 00 00    	jns    1f86 <subdir+0x576>
    printf(1, "open dd rdwr succeeded!\n");
    exit();
  }
  if(open("dd", O_WRONLY) >= 0){
    1caf:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
    1cb6:	00 
    1cb7:	c7 04 24 84 38 00 00 	movl   $0x3884,(%esp)
    1cbe:	e8 81 10 00 00       	call   2d44 <open>
    1cc3:	85 c0                	test   %eax,%eax
    1cc5:	0f 89 a2 02 00 00    	jns    1f6d <subdir+0x55d>
    printf(1, "open dd wronly succeeded!\n");
    exit();
  }
  if(link("dd/ff/ff", "dd/dd/xx") == 0){
    1ccb:	c7 44 24 04 66 39 00 	movl   $0x3966,0x4(%esp)
    1cd2:	00 
    1cd3:	c7 04 24 d2 38 00 00 	movl   $0x38d2,(%esp)
    1cda:	e8 85 10 00 00       	call   2d64 <link>
    1cdf:	85 c0                	test   %eax,%eax
    1ce1:	0f 84 6d 02 00 00    	je     1f54 <subdir+0x544>
    printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n");
    exit();
  }
  if(link("dd/xx/ff", "dd/dd/xx") == 0){
    1ce7:	c7 44 24 04 66 39 00 	movl   $0x3966,0x4(%esp)
    1cee:	00 
    1cef:	c7 04 24 f7 38 00 00 	movl   $0x38f7,(%esp)
    1cf6:	e8 69 10 00 00       	call   2d64 <link>
    1cfb:	85 c0                	test   %eax,%eax
    1cfd:	0f 84 38 02 00 00    	je     1f3b <subdir+0x52b>
    printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n");
    exit();
  }
  if(link("dd/ff", "dd/dd/ffff") == 0){
    1d03:	c7 44 24 04 1e 38 00 	movl   $0x381e,0x4(%esp)
    1d0a:	00 
    1d0b:	c7 04 24 bd 37 00 00 	movl   $0x37bd,(%esp)
    1d12:	e8 4d 10 00 00       	call   2d64 <link>
    1d17:	85 c0                	test   %eax,%eax
    1d19:	0f 84 9f 01 00 00    	je     1ebe <subdir+0x4ae>
    printf(1, "link dd/ff dd/dd/ffff succeeded!\n");
    exit();
  }
  if(mkdir("dd/ff/ff") == 0){
    1d1f:	c7 04 24 d2 38 00 00 	movl   $0x38d2,(%esp)
    1d26:	e8 41 10 00 00       	call   2d6c <mkdir>
    1d2b:	85 c0                	test   %eax,%eax
    1d2d:	0f 84 72 01 00 00    	je     1ea5 <subdir+0x495>
    printf(1, "mkdir dd/ff/ff succeeded!\n");
    exit();
  }
  if(mkdir("dd/xx/ff") == 0){
    1d33:	c7 04 24 f7 38 00 00 	movl   $0x38f7,(%esp)
    1d3a:	e8 2d 10 00 00       	call   2d6c <mkdir>
    1d3f:	85 c0                	test   %eax,%eax
    1d41:	0f 84 01 04 00 00    	je     2148 <subdir+0x738>
    printf(1, "mkdir dd/xx/ff succeeded!\n");
    exit();
  }
  if(mkdir("dd/dd/ffff") == 0){
    1d47:	c7 04 24 1e 38 00 00 	movl   $0x381e,(%esp)
    1d4e:	e8 19 10 00 00       	call   2d6c <mkdir>
    1d53:	85 c0                	test   %eax,%eax
    1d55:	0f 84 d4 03 00 00    	je     212f <subdir+0x71f>
    printf(1, "mkdir dd/dd/ffff succeeded!\n");
    exit();
  }
  if(unlink("dd/xx/ff") == 0){
    1d5b:	c7 04 24 f7 38 00 00 	movl   $0x38f7,(%esp)
    1d62:	e8 ed 0f 00 00       	call   2d54 <unlink>
    1d67:	85 c0                	test   %eax,%eax
    1d69:	0f 84 a7 03 00 00    	je     2116 <subdir+0x706>
    printf(1, "unlink dd/xx/ff succeeded!\n");
    exit();
  }
  if(unlink("dd/ff/ff") == 0){
    1d6f:	c7 04 24 d2 38 00 00 	movl   $0x38d2,(%esp)
    1d76:	e8 d9 0f 00 00       	call   2d54 <unlink>
    1d7b:	85 c0                	test   %eax,%eax
    1d7d:	0f 84 7a 03 00 00    	je     20fd <subdir+0x6ed>
    printf(1, "unlink dd/ff/ff succeeded!\n");
    exit();
  }
  if(chdir("dd/ff") == 0){
    1d83:	c7 04 24 bd 37 00 00 	movl   $0x37bd,(%esp)
    1d8a:	e8 e5 0f 00 00       	call   2d74 <chdir>
    1d8f:	85 c0                	test   %eax,%eax
    1d91:	0f 84 4d 03 00 00    	je     20e4 <subdir+0x6d4>
    printf(1, "chdir dd/ff succeeded!\n");
    exit();
  }
  if(chdir("dd/xx") == 0){
    1d97:	c7 04 24 69 39 00 00 	movl   $0x3969,(%esp)
    1d9e:	e8 d1 0f 00 00       	call   2d74 <chdir>
    1da3:	85 c0                	test   %eax,%eax
    1da5:	0f 84 20 03 00 00    	je     20cb <subdir+0x6bb>
    printf(1, "chdir dd/xx succeeded!\n");
    exit();
  }

  if(unlink("dd/dd/ffff") != 0){
    1dab:	c7 04 24 1e 38 00 00 	movl   $0x381e,(%esp)
    1db2:	e8 9d 0f 00 00       	call   2d54 <unlink>
    1db7:	85 c0                	test   %eax,%eax
    1db9:	0f 85 9b 00 00 00    	jne    1e5a <subdir+0x44a>
    printf(1, "unlink dd/dd/ff failed\n");
    exit();
  }
  if(unlink("dd/ff") != 0){
    1dbf:	c7 04 24 bd 37 00 00 	movl   $0x37bd,(%esp)
    1dc6:	e8 89 0f 00 00       	call   2d54 <unlink>
    1dcb:	85 c0                	test   %eax,%eax
    1dcd:	0f 85 df 02 00 00    	jne    20b2 <subdir+0x6a2>
    printf(1, "unlink dd/ff failed\n");
    exit();
  }
  if(unlink("dd") == 0){
    1dd3:	c7 04 24 84 38 00 00 	movl   $0x3884,(%esp)
    1dda:	e8 75 0f 00 00       	call   2d54 <unlink>
    1ddf:	85 c0                	test   %eax,%eax
    1de1:	0f 84 b2 02 00 00    	je     2099 <subdir+0x689>
    printf(1, "unlink non-empty dd succeeded!\n");
    exit();
  }
  if(unlink("dd/dd") < 0){
    1de7:	c7 04 24 99 37 00 00 	movl   $0x3799,(%esp)
    1dee:	e8 61 0f 00 00       	call   2d54 <unlink>
    1df3:	85 c0                	test   %eax,%eax
    1df5:	0f 88 85 02 00 00    	js     2080 <subdir+0x670>
    printf(1, "unlink dd/dd failed\n");
    exit();
  }
  if(unlink("dd") < 0){
    1dfb:	c7 04 24 84 38 00 00 	movl   $0x3884,(%esp)
    1e02:	e8 4d 0f 00 00       	call   2d54 <unlink>
    1e07:	85 c0                	test   %eax,%eax
    1e09:	0f 88 58 02 00 00    	js     2067 <subdir+0x657>
    printf(1, "unlink dd failed\n");
    exit();
  }

  printf(1, "subdir ok\n");
    1e0f:	c7 44 24 04 66 3a 00 	movl   $0x3a66,0x4(%esp)
    1e16:	00 
    1e17:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1e1e:	e8 2d 10 00 00       	call   2e50 <printf>
}
    1e23:	83 c4 18             	add    $0x18,%esp
    1e26:	5b                   	pop    %ebx
    1e27:	c3                   	ret    
    printf(1, "open dd/dd/../ff failed\n");
    exit();
  }
  cc = read(fd, buf, sizeof(buf));
  if(cc != 2 || buf[0] != 'f'){
    printf(1, "dd/dd/../ff wrong content\n");
    1e28:	c7 44 24 04 03 38 00 	movl   $0x3803,0x4(%esp)
    1e2f:	00 
    1e30:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1e37:	e8 14 10 00 00       	call   2e50 <printf>
    exit();
    1e3c:	e8 c3 0e 00 00       	call   2d04 <exit>
  if(chdir("dd/../../dd") != 0){
    printf(1, "chdir dd/../../dd failed\n");
    exit();
  }
  if(chdir("dd/../../../dd") != 0){
    printf(1, "chdir dd/../../dd failed\n");
    1e41:	c7 44 24 04 5e 38 00 	movl   $0x385e,0x4(%esp)
    1e48:	00 
    1e49:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1e50:	e8 fb 0f 00 00       	call   2e50 <printf>
    exit();
    1e55:	e8 aa 0e 00 00       	call   2d04 <exit>
    printf(1, "chdir dd/xx succeeded!\n");
    exit();
  }

  if(unlink("dd/dd/ffff") != 0){
    printf(1, "unlink dd/dd/ff failed\n");
    1e5a:	c7 44 24 04 29 38 00 	movl   $0x3829,0x4(%esp)
    1e61:	00 
    1e62:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1e69:	e8 e2 0f 00 00       	call   2e50 <printf>
    exit();
    1e6e:	e8 91 0e 00 00       	call   2d04 <exit>
    printf(1, "open (unlinked) dd/dd/ff succeeded!\n");
    exit();
  }

  if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){
    printf(1, "create dd/ff/ff succeeded!\n");
    1e73:	c7 44 24 04 db 38 00 	movl   $0x38db,0x4(%esp)
    1e7a:	00 
    1e7b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1e82:	e8 c9 0f 00 00       	call   2e50 <printf>
    exit();
    1e87:	e8 78 0e 00 00       	call   2d04 <exit>
    exit();
  }
  close(fd);

  if(open("dd/dd/ff", O_RDONLY) >= 0){
    printf(1, "open (unlinked) dd/dd/ff succeeded!\n");
    1e8c:	c7 44 24 04 60 40 00 	movl   $0x4060,0x4(%esp)
    1e93:	00 
    1e94:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1e9b:	e8 b0 0f 00 00       	call   2e50 <printf>
    exit();
    1ea0:	e8 5f 0e 00 00       	call   2d04 <exit>
  if(link("dd/ff", "dd/dd/ffff") == 0){
    printf(1, "link dd/ff dd/dd/ffff succeeded!\n");
    exit();
  }
  if(mkdir("dd/ff/ff") == 0){
    printf(1, "mkdir dd/ff/ff succeeded!\n");
    1ea5:	c7 44 24 04 6f 39 00 	movl   $0x396f,0x4(%esp)
    1eac:	00 
    1ead:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1eb4:	e8 97 0f 00 00       	call   2e50 <printf>
    exit();
    1eb9:	e8 46 0e 00 00       	call   2d04 <exit>
  if(link("dd/xx/ff", "dd/dd/xx") == 0){
    printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n");
    exit();
  }
  if(link("dd/ff", "dd/dd/ffff") == 0){
    printf(1, "link dd/ff dd/dd/ffff succeeded!\n");
    1ebe:	c7 44 24 04 d0 40 00 	movl   $0x40d0,0x4(%esp)
    1ec5:	00 
    1ec6:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1ecd:	e8 7e 0f 00 00       	call   2e50 <printf>
    exit();
    1ed2:	e8 2d 0e 00 00       	call   2d04 <exit>
  write(fd, "FF", 2);
  close(fd);

  fd = open("dd/dd/../ff", 0);
  if(fd < 0){
    printf(1, "open dd/dd/../ff failed\n");
    1ed7:	c7 44 24 04 ea 37 00 	movl   $0x37ea,0x4(%esp)
    1ede:	00 
    1edf:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1ee6:	e8 65 0f 00 00       	call   2e50 <printf>
    exit();
    1eeb:	e8 14 0e 00 00       	call   2d04 <exit>
    exit();
  }

  fd = open("dd/dd/ff", O_CREATE | O_RDWR);
  if(fd < 0){
    printf(1, "create dd/dd/ff failed\n");
    1ef0:	c7 44 24 04 c3 37 00 	movl   $0x37c3,0x4(%esp)
    1ef7:	00 
    1ef8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1eff:	e8 4c 0f 00 00       	call   2e50 <printf>
    exit();
    1f04:	e8 fb 0d 00 00       	call   2d04 <exit>
  if(chdir("dd/../../../dd") != 0){
    printf(1, "chdir dd/../../dd failed\n");
    exit();
  }
  if(chdir("./..") != 0){
    printf(1, "chdir ./.. failed\n");
    1f09:	c7 44 24 04 8c 38 00 	movl   $0x388c,0x4(%esp)
    1f10:	00 
    1f11:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1f18:	e8 33 0f 00 00       	call   2e50 <printf>
    exit();
    1f1d:	e8 e2 0d 00 00       	call   2d04 <exit>
    exit();
  }
  close(fd);

  if(link("dd/dd/ff", "dd/dd/ffff") != 0){
    printf(1, "link dd/dd/ff dd/dd/ffff failed\n");
    1f22:	c7 44 24 04 18 40 00 	movl   $0x4018,0x4(%esp)
    1f29:	00 
    1f2a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1f31:	e8 1a 0f 00 00       	call   2e50 <printf>
    exit();
    1f36:	e8 c9 0d 00 00       	call   2d04 <exit>
  if(link("dd/ff/ff", "dd/dd/xx") == 0){
    printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n");
    exit();
  }
  if(link("dd/xx/ff", "dd/dd/xx") == 0){
    printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n");
    1f3b:	c7 44 24 04 ac 40 00 	movl   $0x40ac,0x4(%esp)
    1f42:	00 
    1f43:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1f4a:	e8 01 0f 00 00       	call   2e50 <printf>
    exit();
    1f4f:	e8 b0 0d 00 00       	call   2d04 <exit>
  if(open("dd", O_WRONLY) >= 0){
    printf(1, "open dd wronly succeeded!\n");
    exit();
  }
  if(link("dd/ff/ff", "dd/dd/xx") == 0){
    printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n");
    1f54:	c7 44 24 04 88 40 00 	movl   $0x4088,0x4(%esp)
    1f5b:	00 
    1f5c:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1f63:	e8 e8 0e 00 00       	call   2e50 <printf>
    exit();
    1f68:	e8 97 0d 00 00       	call   2d04 <exit>
  if(open("dd", O_RDWR) >= 0){
    printf(1, "open dd rdwr succeeded!\n");
    exit();
  }
  if(open("dd", O_WRONLY) >= 0){
    printf(1, "open dd wronly succeeded!\n");
    1f6d:	c7 44 24 04 4b 39 00 	movl   $0x394b,0x4(%esp)
    1f74:	00 
    1f75:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1f7c:	e8 cf 0e 00 00       	call   2e50 <printf>
    exit();
    1f81:	e8 7e 0d 00 00       	call   2d04 <exit>
  if(open("dd", O_CREATE) >= 0){
    printf(1, "create dd succeeded!\n");
    exit();
  }
  if(open("dd", O_RDWR) >= 0){
    printf(1, "open dd rdwr succeeded!\n");
    1f86:	c7 44 24 04 32 39 00 	movl   $0x3932,0x4(%esp)
    1f8d:	00 
    1f8e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1f95:	e8 b6 0e 00 00       	call   2e50 <printf>
    exit();
    1f9a:	e8 65 0d 00 00       	call   2d04 <exit>
  if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){
    printf(1, "create dd/xx/ff succeeded!\n");
    exit();
  }
  if(open("dd", O_CREATE) >= 0){
    printf(1, "create dd succeeded!\n");
    1f9f:	c7 44 24 04 1c 39 00 	movl   $0x391c,0x4(%esp)
    1fa6:	00 
    1fa7:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1fae:	e8 9d 0e 00 00       	call   2e50 <printf>
    exit();
    1fb3:	e8 4c 0d 00 00       	call   2d04 <exit>
  if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){
    printf(1, "create dd/ff/ff succeeded!\n");
    exit();
  }
  if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){
    printf(1, "create dd/xx/ff succeeded!\n");
    1fb8:	c7 44 24 04 00 39 00 	movl   $0x3900,0x4(%esp)
    1fbf:	00 
    1fc0:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1fc7:	e8 84 0e 00 00       	call   2e50 <printf>
    exit();
    1fcc:	e8 33 0d 00 00       	call   2d04 <exit>
    printf(1, "open (unlinked) dd/dd/ff succeeded\n");
    exit();
  }

  if(chdir("dd") != 0){
    printf(1, "chdir dd failed\n");
    1fd1:	c7 44 24 04 41 38 00 	movl   $0x3841,0x4(%esp)
    1fd8:	00 
    1fd9:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1fe0:	e8 6b 0e 00 00       	call   2e50 <printf>
    exit();
    1fe5:	e8 1a 0d 00 00       	call   2d04 <exit>
  if(unlink("dd/dd/ff") != 0){
    printf(1, "unlink dd/dd/ff failed\n");
    exit();
  }
  if(open("dd/dd/ff", O_RDONLY) >= 0){
    printf(1, "open (unlinked) dd/dd/ff succeeded\n");
    1fea:	c7 44 24 04 3c 40 00 	movl   $0x403c,0x4(%esp)
    1ff1:	00 
    1ff2:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    1ff9:	e8 52 0e 00 00       	call   2e50 <printf>
    exit();
    1ffe:	e8 01 0d 00 00       	call   2d04 <exit>
    printf(1, "unlink dd (non-empty dir) succeeded!\n");
    exit();
  }

  if(mkdir("/dd/dd") != 0){
    printf(1, "subdir mkdir dd/dd failed\n");
    2003:	c7 44 24 04 9f 37 00 	movl   $0x379f,0x4(%esp)
    200a:	00 
    200b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2012:	e8 39 0e 00 00       	call   2e50 <printf>
    exit();
    2017:	e8 e8 0c 00 00       	call   2d04 <exit>
  }
  write(fd, "ff", 2);
  close(fd);
  
  if(unlink("dd") >= 0){
    printf(1, "unlink dd (non-empty dir) succeeded!\n");
    201c:	c7 44 24 04 f0 3f 00 	movl   $0x3ff0,0x4(%esp)
    2023:	00 
    2024:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    202b:	e8 20 0e 00 00       	call   2e50 <printf>
    exit();
    2030:	e8 cf 0c 00 00       	call   2d04 <exit>
    exit();
  }

  fd = open("dd/ff", O_CREATE | O_RDWR);
  if(fd < 0){
    printf(1, "create dd/ff failed\n");
    2035:	c7 44 24 04 83 37 00 	movl   $0x3783,0x4(%esp)
    203c:	00 
    203d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2044:	e8 07 0e 00 00       	call   2e50 <printf>
    exit();
    2049:	e8 b6 0c 00 00       	call   2d04 <exit>

  printf(1, "subdir test\n");

  unlink("ff");
  if(mkdir("dd") != 0){
    printf(1, "subdir mkdir dd failed\n");
    204e:	c7 44 24 04 6b 37 00 	movl   $0x376b,0x4(%esp)
    2055:	00 
    2056:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    205d:	e8 ee 0d 00 00       	call   2e50 <printf>
    exit();
    2062:	e8 9d 0c 00 00       	call   2d04 <exit>
  if(unlink("dd/dd") < 0){
    printf(1, "unlink dd/dd failed\n");
    exit();
  }
  if(unlink("dd") < 0){
    printf(1, "unlink dd failed\n");
    2067:	c7 44 24 04 54 3a 00 	movl   $0x3a54,0x4(%esp)
    206e:	00 
    206f:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2076:	e8 d5 0d 00 00       	call   2e50 <printf>
    exit();
    207b:	e8 84 0c 00 00       	call   2d04 <exit>
  if(unlink("dd") == 0){
    printf(1, "unlink non-empty dd succeeded!\n");
    exit();
  }
  if(unlink("dd/dd") < 0){
    printf(1, "unlink dd/dd failed\n");
    2080:	c7 44 24 04 3f 3a 00 	movl   $0x3a3f,0x4(%esp)
    2087:	00 
    2088:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    208f:	e8 bc 0d 00 00       	call   2e50 <printf>
    exit();
    2094:	e8 6b 0c 00 00       	call   2d04 <exit>
  if(unlink("dd/ff") != 0){
    printf(1, "unlink dd/ff failed\n");
    exit();
  }
  if(unlink("dd") == 0){
    printf(1, "unlink non-empty dd succeeded!\n");
    2099:	c7 44 24 04 f4 40 00 	movl   $0x40f4,0x4(%esp)
    20a0:	00 
    20a1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    20a8:	e8 a3 0d 00 00       	call   2e50 <printf>
    exit();
    20ad:	e8 52 0c 00 00       	call   2d04 <exit>
  if(unlink("dd/dd/ffff") != 0){
    printf(1, "unlink dd/dd/ff failed\n");
    exit();
  }
  if(unlink("dd/ff") != 0){
    printf(1, "unlink dd/ff failed\n");
    20b2:	c7 44 24 04 2a 3a 00 	movl   $0x3a2a,0x4(%esp)
    20b9:	00 
    20ba:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    20c1:	e8 8a 0d 00 00       	call   2e50 <printf>
    exit();
    20c6:	e8 39 0c 00 00       	call   2d04 <exit>
  if(chdir("dd/ff") == 0){
    printf(1, "chdir dd/ff succeeded!\n");
    exit();
  }
  if(chdir("dd/xx") == 0){
    printf(1, "chdir dd/xx succeeded!\n");
    20cb:	c7 44 24 04 12 3a 00 	movl   $0x3a12,0x4(%esp)
    20d2:	00 
    20d3:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    20da:	e8 71 0d 00 00       	call   2e50 <printf>
    exit();
    20df:	e8 20 0c 00 00       	call   2d04 <exit>
  if(unlink("dd/ff/ff") == 0){
    printf(1, "unlink dd/ff/ff succeeded!\n");
    exit();
  }
  if(chdir("dd/ff") == 0){
    printf(1, "chdir dd/ff succeeded!\n");
    20e4:	c7 44 24 04 fa 39 00 	movl   $0x39fa,0x4(%esp)
    20eb:	00 
    20ec:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    20f3:	e8 58 0d 00 00       	call   2e50 <printf>
    exit();
    20f8:	e8 07 0c 00 00       	call   2d04 <exit>
  if(unlink("dd/xx/ff") == 0){
    printf(1, "unlink dd/xx/ff succeeded!\n");
    exit();
  }
  if(unlink("dd/ff/ff") == 0){
    printf(1, "unlink dd/ff/ff succeeded!\n");
    20fd:	c7 44 24 04 de 39 00 	movl   $0x39de,0x4(%esp)
    2104:	00 
    2105:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    210c:	e8 3f 0d 00 00       	call   2e50 <printf>
    exit();
    2111:	e8 ee 0b 00 00       	call   2d04 <exit>
  if(mkdir("dd/dd/ffff") == 0){
    printf(1, "mkdir dd/dd/ffff succeeded!\n");
    exit();
  }
  if(unlink("dd/xx/ff") == 0){
    printf(1, "unlink dd/xx/ff succeeded!\n");
    2116:	c7 44 24 04 c2 39 00 	movl   $0x39c2,0x4(%esp)
    211d:	00 
    211e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2125:	e8 26 0d 00 00       	call   2e50 <printf>
    exit();
    212a:	e8 d5 0b 00 00       	call   2d04 <exit>
  if(mkdir("dd/xx/ff") == 0){
    printf(1, "mkdir dd/xx/ff succeeded!\n");
    exit();
  }
  if(mkdir("dd/dd/ffff") == 0){
    printf(1, "mkdir dd/dd/ffff succeeded!\n");
    212f:	c7 44 24 04 a5 39 00 	movl   $0x39a5,0x4(%esp)
    2136:	00 
    2137:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    213e:	e8 0d 0d 00 00       	call   2e50 <printf>
    exit();
    2143:	e8 bc 0b 00 00       	call   2d04 <exit>
  if(mkdir("dd/ff/ff") == 0){
    printf(1, "mkdir dd/ff/ff succeeded!\n");
    exit();
  }
  if(mkdir("dd/xx/ff") == 0){
    printf(1, "mkdir dd/xx/ff succeeded!\n");
    2148:	c7 44 24 04 8a 39 00 	movl   $0x398a,0x4(%esp)
    214f:	00 
    2150:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2157:	e8 f4 0c 00 00       	call   2e50 <printf>
    exit();
    215c:	e8 a3 0b 00 00       	call   2d04 <exit>
  if(fd < 0){
    printf(1, "open dd/dd/ffff failed\n");
    exit();
  }
  if(read(fd, buf, sizeof(buf)) != 2){
    printf(1, "read dd/dd/ffff wrong len\n");
    2161:	c7 44 24 04 b7 38 00 	movl   $0x38b7,0x4(%esp)
    2168:	00 
    2169:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2170:	e8 db 0c 00 00       	call   2e50 <printf>
    exit();
    2175:	e8 8a 0b 00 00       	call   2d04 <exit>
    exit();
  }

  fd = open("dd/dd/ffff", 0);
  if(fd < 0){
    printf(1, "open dd/dd/ffff failed\n");
    217a:	c7 44 24 04 9f 38 00 	movl   $0x389f,0x4(%esp)
    2181:	00 
    2182:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2189:	e8 c2 0c 00 00       	call   2e50 <printf>
    exit();
    218e:	e8 71 0b 00 00       	call   2d04 <exit>
    2193:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    2199:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

000021a0 <bigfile>:
  printf(1, "subdir ok\n");
}

void
bigfile(void)
{
    21a0:	57                   	push   %edi
    21a1:	56                   	push   %esi
    21a2:	53                   	push   %ebx
    21a3:	83 ec 10             	sub    $0x10,%esp
  int fd, i, total, cc;

  printf(1, "bigfile test\n");
    21a6:	c7 44 24 04 71 3a 00 	movl   $0x3a71,0x4(%esp)
    21ad:	00 
    21ae:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    21b5:	e8 96 0c 00 00       	call   2e50 <printf>

  unlink("bigfile");
    21ba:	c7 04 24 8d 3a 00 00 	movl   $0x3a8d,(%esp)
    21c1:	e8 8e 0b 00 00       	call   2d54 <unlink>
  fd = open("bigfile", O_CREATE | O_RDWR);
    21c6:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
    21cd:	00 
    21ce:	c7 04 24 8d 3a 00 00 	movl   $0x3a8d,(%esp)
    21d5:	e8 6a 0b 00 00       	call   2d44 <open>
  if(fd < 0){
    21da:	85 c0                	test   %eax,%eax
  int fd, i, total, cc;

  printf(1, "bigfile test\n");

  unlink("bigfile");
  fd = open("bigfile", O_CREATE | O_RDWR);
    21dc:	89 c6                	mov    %eax,%esi
  if(fd < 0){
    21de:	0f 88 79 01 00 00    	js     235d <bigfile+0x1bd>
    21e4:	31 db                	xor    %ebx,%ebx
    21e6:	66 90                	xchg   %ax,%ax
    printf(1, "cannot create bigfile");
    exit();
  }
  for(i = 0; i < 20; i++){
    memset(buf, i, 600);
    21e8:	c7 44 24 08 58 02 00 	movl   $0x258,0x8(%esp)
    21ef:	00 
    21f0:	89 5c 24 04          	mov    %ebx,0x4(%esp)
    21f4:	c7 04 24 e0 4a 00 00 	movl   $0x4ae0,(%esp)
    21fb:	e8 40 09 00 00       	call   2b40 <memset>
    if(write(fd, buf, 600) != 600){
    2200:	c7 44 24 08 58 02 00 	movl   $0x258,0x8(%esp)
    2207:	00 
    2208:	c7 44 24 04 e0 4a 00 	movl   $0x4ae0,0x4(%esp)
    220f:	00 
    2210:	89 34 24             	mov    %esi,(%esp)
    2213:	e8 0c 0b 00 00       	call   2d24 <write>
    2218:	3d 58 02 00 00       	cmp    $0x258,%eax
    221d:	0f 85 08 01 00 00    	jne    232b <bigfile+0x18b>
  fd = open("bigfile", O_CREATE | O_RDWR);
  if(fd < 0){
    printf(1, "cannot create bigfile");
    exit();
  }
  for(i = 0; i < 20; i++){
    2223:	83 c3 01             	add    $0x1,%ebx
    2226:	83 fb 14             	cmp    $0x14,%ebx
    2229:	75 bd                	jne    21e8 <bigfile+0x48>
    if(write(fd, buf, 600) != 600){
      printf(1, "write bigfile failed\n");
      exit();
    }
  }
  close(fd);
    222b:	89 34 24             	mov    %esi,(%esp)
    222e:	e8 f9 0a 00 00       	call   2d2c <close>

  fd = open("bigfile", 0);
    2233:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    223a:	00 
    223b:	c7 04 24 8d 3a 00 00 	movl   $0x3a8d,(%esp)
    2242:	e8 fd 0a 00 00       	call   2d44 <open>
  if(fd < 0){
    2247:	85 c0                	test   %eax,%eax
      exit();
    }
  }
  close(fd);

  fd = open("bigfile", 0);
    2249:	89 c7                	mov    %eax,%edi
  if(fd < 0){
    224b:	0f 88 f3 00 00 00    	js     2344 <bigfile+0x1a4>
    2251:	31 f6                	xor    %esi,%esi
    2253:	31 db                	xor    %ebx,%ebx
    2255:	eb 2f                	jmp    2286 <bigfile+0xe6>
    2257:	90                   	nop
      printf(1, "read bigfile failed\n");
      exit();
    }
    if(cc == 0)
      break;
    if(cc != 300){
    2258:	3d 2c 01 00 00       	cmp    $0x12c,%eax
    225d:	0f 85 96 00 00 00    	jne    22f9 <bigfile+0x159>
      printf(1, "short read bigfile\n");
      exit();
    }
    if(buf[0] != i/2 || buf[299] != i/2){
    2263:	0f be 05 e0 4a 00 00 	movsbl 0x4ae0,%eax
    226a:	89 da                	mov    %ebx,%edx
    226c:	d1 fa                	sar    %edx
    226e:	39 d0                	cmp    %edx,%eax
    2270:	75 6e                	jne    22e0 <bigfile+0x140>
    2272:	0f be 15 0b 4c 00 00 	movsbl 0x4c0b,%edx
    2279:	39 d0                	cmp    %edx,%eax
    227b:	75 63                	jne    22e0 <bigfile+0x140>
      printf(1, "read bigfile wrong data\n");
      exit();
    }
    total += cc;
    227d:	81 c6 2c 01 00 00    	add    $0x12c,%esi
  if(fd < 0){
    printf(1, "cannot open bigfile\n");
    exit();
  }
  total = 0;
  for(i = 0; ; i++){
    2283:	83 c3 01             	add    $0x1,%ebx
    cc = read(fd, buf, 300);
    2286:	c7 44 24 08 2c 01 00 	movl   $0x12c,0x8(%esp)
    228d:	00 
    228e:	c7 44 24 04 e0 4a 00 	movl   $0x4ae0,0x4(%esp)
    2295:	00 
    2296:	89 3c 24             	mov    %edi,(%esp)
    2299:	e8 7e 0a 00 00       	call   2d1c <read>
    if(cc < 0){
    229e:	83 f8 00             	cmp    $0x0,%eax
    22a1:	7c 6f                	jl     2312 <bigfile+0x172>
      printf(1, "read bigfile failed\n");
      exit();
    }
    if(cc == 0)
    22a3:	75 b3                	jne    2258 <bigfile+0xb8>
      printf(1, "read bigfile wrong data\n");
      exit();
    }
    total += cc;
  }
  close(fd);
    22a5:	89 3c 24             	mov    %edi,(%esp)
    22a8:	e8 7f 0a 00 00       	call   2d2c <close>
  if(total != 20*600){
    22ad:	81 fe e0 2e 00 00    	cmp    $0x2ee0,%esi
    22b3:	0f 85 bd 00 00 00    	jne    2376 <bigfile+0x1d6>
    printf(1, "read bigfile wrong total\n");
    exit();
  }
  unlink("bigfile");
    22b9:	c7 04 24 8d 3a 00 00 	movl   $0x3a8d,(%esp)
    22c0:	e8 8f 0a 00 00       	call   2d54 <unlink>

  printf(1, "bigfile test ok\n");
    22c5:	c7 44 24 04 1c 3b 00 	movl   $0x3b1c,0x4(%esp)
    22cc:	00 
    22cd:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    22d4:	e8 77 0b 00 00       	call   2e50 <printf>
}
    22d9:	83 c4 10             	add    $0x10,%esp
    22dc:	5b                   	pop    %ebx
    22dd:	5e                   	pop    %esi
    22de:	5f                   	pop    %edi
    22df:	c3                   	ret    
    if(cc != 300){
      printf(1, "short read bigfile\n");
      exit();
    }
    if(buf[0] != i/2 || buf[299] != i/2){
      printf(1, "read bigfile wrong data\n");
    22e0:	c7 44 24 04 e9 3a 00 	movl   $0x3ae9,0x4(%esp)
    22e7:	00 
    22e8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    22ef:	e8 5c 0b 00 00       	call   2e50 <printf>
      exit();
    22f4:	e8 0b 0a 00 00       	call   2d04 <exit>
      exit();
    }
    if(cc == 0)
      break;
    if(cc != 300){
      printf(1, "short read bigfile\n");
    22f9:	c7 44 24 04 d5 3a 00 	movl   $0x3ad5,0x4(%esp)
    2300:	00 
    2301:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2308:	e8 43 0b 00 00       	call   2e50 <printf>
      exit();
    230d:	e8 f2 09 00 00       	call   2d04 <exit>
  }
  total = 0;
  for(i = 0; ; i++){
    cc = read(fd, buf, 300);
    if(cc < 0){
      printf(1, "read bigfile failed\n");
    2312:	c7 44 24 04 c0 3a 00 	movl   $0x3ac0,0x4(%esp)
    2319:	00 
    231a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2321:	e8 2a 0b 00 00       	call   2e50 <printf>
      exit();
    2326:	e8 d9 09 00 00       	call   2d04 <exit>
    exit();
  }
  for(i = 0; i < 20; i++){
    memset(buf, i, 600);
    if(write(fd, buf, 600) != 600){
      printf(1, "write bigfile failed\n");
    232b:	c7 44 24 04 95 3a 00 	movl   $0x3a95,0x4(%esp)
    2332:	00 
    2333:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    233a:	e8 11 0b 00 00       	call   2e50 <printf>
      exit();
    233f:	e8 c0 09 00 00       	call   2d04 <exit>
  }
  close(fd);

  fd = open("bigfile", 0);
  if(fd < 0){
    printf(1, "cannot open bigfile\n");
    2344:	c7 44 24 04 ab 3a 00 	movl   $0x3aab,0x4(%esp)
    234b:	00 
    234c:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2353:	e8 f8 0a 00 00       	call   2e50 <printf>
    exit();
    2358:	e8 a7 09 00 00       	call   2d04 <exit>
  printf(1, "bigfile test\n");

  unlink("bigfile");
  fd = open("bigfile", O_CREATE | O_RDWR);
  if(fd < 0){
    printf(1, "cannot create bigfile");
    235d:	c7 44 24 04 7f 3a 00 	movl   $0x3a7f,0x4(%esp)
    2364:	00 
    2365:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    236c:	e8 df 0a 00 00       	call   2e50 <printf>
    exit();
    2371:	e8 8e 09 00 00       	call   2d04 <exit>
    }
    total += cc;
  }
  close(fd);
  if(total != 20*600){
    printf(1, "read bigfile wrong total\n");
    2376:	c7 44 24 04 02 3b 00 	movl   $0x3b02,0x4(%esp)
    237d:	00 
    237e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2385:	e8 c6 0a 00 00       	call   2e50 <printf>
    exit();
    238a:	e8 75 09 00 00       	call   2d04 <exit>
    238f:	90                   	nop

00002390 <fourteen>:
  printf(1, "bigfile test ok\n");
}

void
fourteen(void)
{
    2390:	83 ec 1c             	sub    $0x1c,%esp
  int fd;

  // DIRSIZ is 14.
  printf(1, "fourteen test\n");
    2393:	c7 44 24 04 2d 3b 00 	movl   $0x3b2d,0x4(%esp)
    239a:	00 
    239b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    23a2:	e8 a9 0a 00 00       	call   2e50 <printf>

  if(mkdir("12345678901234") != 0){
    23a7:	c7 04 24 68 3b 00 00 	movl   $0x3b68,(%esp)
    23ae:	e8 b9 09 00 00       	call   2d6c <mkdir>
    23b3:	85 c0                	test   %eax,%eax
    23b5:	0f 85 94 00 00 00    	jne    244f <fourteen+0xbf>
    printf(1, "mkdir 12345678901234 failed\n");
    exit();
  }
  if(mkdir("12345678901234/123456789012345") != 0){
    23bb:	c7 04 24 14 41 00 00 	movl   $0x4114,(%esp)
    23c2:	e8 a5 09 00 00       	call   2d6c <mkdir>
    23c7:	85 c0                	test   %eax,%eax
    23c9:	0f 85 fd 00 00 00    	jne    24cc <fourteen+0x13c>
    printf(1, "mkdir 12345678901234/123456789012345 failed\n");
    exit();
  }
  fd = open("123456789012345/123456789012345/123456789012345", O_CREATE);
    23cf:	c7 44 24 04 00 02 00 	movl   $0x200,0x4(%esp)
    23d6:	00 
    23d7:	c7 04 24 64 41 00 00 	movl   $0x4164,(%esp)
    23de:	e8 61 09 00 00       	call   2d44 <open>
  if(fd < 0){
    23e3:	85 c0                	test   %eax,%eax
    23e5:	0f 88 c8 00 00 00    	js     24b3 <fourteen+0x123>
    printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n");
    exit();
  }
  close(fd);
    23eb:	89 04 24             	mov    %eax,(%esp)
    23ee:	e8 39 09 00 00       	call   2d2c <close>
  fd = open("12345678901234/12345678901234/12345678901234", 0);
    23f3:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    23fa:	00 
    23fb:	c7 04 24 d4 41 00 00 	movl   $0x41d4,(%esp)
    2402:	e8 3d 09 00 00       	call   2d44 <open>
  if(fd < 0){
    2407:	85 c0                	test   %eax,%eax
    2409:	0f 88 8b 00 00 00    	js     249a <fourteen+0x10a>
    printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n");
    exit();
  }
  close(fd);
    240f:	89 04 24             	mov    %eax,(%esp)
    2412:	e8 15 09 00 00       	call   2d2c <close>

  if(mkdir("12345678901234/12345678901234") == 0){
    2417:	c7 04 24 59 3b 00 00 	movl   $0x3b59,(%esp)
    241e:	e8 49 09 00 00       	call   2d6c <mkdir>
    2423:	85 c0                	test   %eax,%eax
    2425:	74 5a                	je     2481 <fourteen+0xf1>
    printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n");
    exit();
  }
  if(mkdir("123456789012345/12345678901234") == 0){
    2427:	c7 04 24 70 42 00 00 	movl   $0x4270,(%esp)
    242e:	e8 39 09 00 00       	call   2d6c <mkdir>
    2433:	85 c0                	test   %eax,%eax
    2435:	74 31                	je     2468 <fourteen+0xd8>
    printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n");
    exit();
  }

  printf(1, "fourteen ok\n");
    2437:	c7 44 24 04 77 3b 00 	movl   $0x3b77,0x4(%esp)
    243e:	00 
    243f:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2446:	e8 05 0a 00 00       	call   2e50 <printf>
}
    244b:	83 c4 1c             	add    $0x1c,%esp
    244e:	c3                   	ret    

  // DIRSIZ is 14.
  printf(1, "fourteen test\n");

  if(mkdir("12345678901234") != 0){
    printf(1, "mkdir 12345678901234 failed\n");
    244f:	c7 44 24 04 3c 3b 00 	movl   $0x3b3c,0x4(%esp)
    2456:	00 
    2457:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    245e:	e8 ed 09 00 00       	call   2e50 <printf>
    exit();
    2463:	e8 9c 08 00 00       	call   2d04 <exit>
  if(mkdir("12345678901234/12345678901234") == 0){
    printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n");
    exit();
  }
  if(mkdir("123456789012345/12345678901234") == 0){
    printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n");
    2468:	c7 44 24 04 90 42 00 	movl   $0x4290,0x4(%esp)
    246f:	00 
    2470:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2477:	e8 d4 09 00 00       	call   2e50 <printf>
    exit();
    247c:	e8 83 08 00 00       	call   2d04 <exit>
    exit();
  }
  close(fd);

  if(mkdir("12345678901234/12345678901234") == 0){
    printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n");
    2481:	c7 44 24 04 40 42 00 	movl   $0x4240,0x4(%esp)
    2488:	00 
    2489:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2490:	e8 bb 09 00 00       	call   2e50 <printf>
    exit();
    2495:	e8 6a 08 00 00       	call   2d04 <exit>
    exit();
  }
  close(fd);
  fd = open("12345678901234/12345678901234/12345678901234", 0);
  if(fd < 0){
    printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n");
    249a:	c7 44 24 04 04 42 00 	movl   $0x4204,0x4(%esp)
    24a1:	00 
    24a2:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    24a9:	e8 a2 09 00 00       	call   2e50 <printf>
    exit();
    24ae:	e8 51 08 00 00       	call   2d04 <exit>
    printf(1, "mkdir 12345678901234/123456789012345 failed\n");
    exit();
  }
  fd = open("123456789012345/123456789012345/123456789012345", O_CREATE);
  if(fd < 0){
    printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n");
    24b3:	c7 44 24 04 94 41 00 	movl   $0x4194,0x4(%esp)
    24ba:	00 
    24bb:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    24c2:	e8 89 09 00 00       	call   2e50 <printf>
    exit();
    24c7:	e8 38 08 00 00       	call   2d04 <exit>
  if(mkdir("12345678901234") != 0){
    printf(1, "mkdir 12345678901234 failed\n");
    exit();
  }
  if(mkdir("12345678901234/123456789012345") != 0){
    printf(1, "mkdir 12345678901234/123456789012345 failed\n");
    24cc:	c7 44 24 04 34 41 00 	movl   $0x4134,0x4(%esp)
    24d3:	00 
    24d4:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    24db:	e8 70 09 00 00       	call   2e50 <printf>
    exit();
    24e0:	e8 1f 08 00 00       	call   2d04 <exit>
    24e5:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    24e9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

000024f0 <rmdot>:
  printf(1, "fourteen ok\n");
}

void
rmdot(void)
{
    24f0:	83 ec 1c             	sub    $0x1c,%esp
  printf(1, "rmdot test\n");
    24f3:	c7 44 24 04 84 3b 00 	movl   $0x3b84,0x4(%esp)
    24fa:	00 
    24fb:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2502:	e8 49 09 00 00       	call   2e50 <printf>
  if(mkdir("dots") != 0){
    2507:	c7 04 24 90 3b 00 00 	movl   $0x3b90,(%esp)
    250e:	e8 59 08 00 00       	call   2d6c <mkdir>
    2513:	85 c0                	test   %eax,%eax
    2515:	0f 85 9c 00 00 00    	jne    25b7 <rmdot+0xc7>
    printf(1, "mkdir dots failed\n");
    exit();
  }
  if(chdir("dots") != 0){
    251b:	c7 04 24 90 3b 00 00 	movl   $0x3b90,(%esp)
    2522:	e8 4d 08 00 00       	call   2d74 <chdir>
    2527:	85 c0                	test   %eax,%eax
    2529:	0f 85 37 01 00 00    	jne    2666 <rmdot+0x176>
    printf(1, "chdir dots failed\n");
    exit();
  }
  if(unlink(".") == 0){
    252f:	c7 04 24 8a 38 00 00 	movl   $0x388a,(%esp)
    2536:	e8 19 08 00 00       	call   2d54 <unlink>
    253b:	85 c0                	test   %eax,%eax
    253d:	0f 84 0a 01 00 00    	je     264d <rmdot+0x15d>
    printf(1, "rm . worked!\n");
    exit();
  }
  if(unlink("..") == 0){
    2543:	c7 04 24 89 38 00 00 	movl   $0x3889,(%esp)
    254a:	e8 05 08 00 00       	call   2d54 <unlink>
    254f:	85 c0                	test   %eax,%eax
    2551:	0f 84 dd 00 00 00    	je     2634 <rmdot+0x144>
    printf(1, "rm .. worked!\n");
    exit();
  }
  if(chdir("/") != 0){
    2557:	c7 04 24 d8 3b 00 00 	movl   $0x3bd8,(%esp)
    255e:	e8 11 08 00 00       	call   2d74 <chdir>
    2563:	85 c0                	test   %eax,%eax
    2565:	0f 85 b0 00 00 00    	jne    261b <rmdot+0x12b>
    printf(1, "chdir / failed\n");
    exit();
  }
  if(unlink("dots/.") == 0){
    256b:	c7 04 24 ea 3b 00 00 	movl   $0x3bea,(%esp)
    2572:	e8 dd 07 00 00       	call   2d54 <unlink>
    2577:	85 c0                	test   %eax,%eax
    2579:	0f 84 83 00 00 00    	je     2602 <rmdot+0x112>
    printf(1, "unlink dots/. worked!\n");
    exit();
  }
  if(unlink("dots/..") == 0){
    257f:	c7 04 24 08 3c 00 00 	movl   $0x3c08,(%esp)
    2586:	e8 c9 07 00 00       	call   2d54 <unlink>
    258b:	85 c0                	test   %eax,%eax
    258d:	74 5a                	je     25e9 <rmdot+0xf9>
    printf(1, "unlink dots/.. worked!\n");
    exit();
  }
  if(unlink("dots") != 0){
    258f:	c7 04 24 90 3b 00 00 	movl   $0x3b90,(%esp)
    2596:	e8 b9 07 00 00       	call   2d54 <unlink>
    259b:	85 c0                	test   %eax,%eax
    259d:	75 31                	jne    25d0 <rmdot+0xe0>
    printf(1, "unlink dots failed!\n");
    exit();
  }
  printf(1, "rmdot ok\n");
    259f:	c7 44 24 04 3d 3c 00 	movl   $0x3c3d,0x4(%esp)
    25a6:	00 
    25a7:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    25ae:	e8 9d 08 00 00       	call   2e50 <printf>
}
    25b3:	83 c4 1c             	add    $0x1c,%esp
    25b6:	c3                   	ret    
void
rmdot(void)
{
  printf(1, "rmdot test\n");
  if(mkdir("dots") != 0){
    printf(1, "mkdir dots failed\n");
    25b7:	c7 44 24 04 95 3b 00 	movl   $0x3b95,0x4(%esp)
    25be:	00 
    25bf:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    25c6:	e8 85 08 00 00       	call   2e50 <printf>
    exit();
    25cb:	e8 34 07 00 00       	call   2d04 <exit>
  if(unlink("dots/..") == 0){
    printf(1, "unlink dots/.. worked!\n");
    exit();
  }
  if(unlink("dots") != 0){
    printf(1, "unlink dots failed!\n");
    25d0:	c7 44 24 04 28 3c 00 	movl   $0x3c28,0x4(%esp)
    25d7:	00 
    25d8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    25df:	e8 6c 08 00 00       	call   2e50 <printf>
    exit();
    25e4:	e8 1b 07 00 00       	call   2d04 <exit>
  if(unlink("dots/.") == 0){
    printf(1, "unlink dots/. worked!\n");
    exit();
  }
  if(unlink("dots/..") == 0){
    printf(1, "unlink dots/.. worked!\n");
    25e9:	c7 44 24 04 10 3c 00 	movl   $0x3c10,0x4(%esp)
    25f0:	00 
    25f1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    25f8:	e8 53 08 00 00       	call   2e50 <printf>
    exit();
    25fd:	e8 02 07 00 00       	call   2d04 <exit>
  if(chdir("/") != 0){
    printf(1, "chdir / failed\n");
    exit();
  }
  if(unlink("dots/.") == 0){
    printf(1, "unlink dots/. worked!\n");
    2602:	c7 44 24 04 f1 3b 00 	movl   $0x3bf1,0x4(%esp)
    2609:	00 
    260a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2611:	e8 3a 08 00 00       	call   2e50 <printf>
    exit();
    2616:	e8 e9 06 00 00       	call   2d04 <exit>
  if(unlink("..") == 0){
    printf(1, "rm .. worked!\n");
    exit();
  }
  if(chdir("/") != 0){
    printf(1, "chdir / failed\n");
    261b:	c7 44 24 04 da 3b 00 	movl   $0x3bda,0x4(%esp)
    2622:	00 
    2623:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    262a:	e8 21 08 00 00       	call   2e50 <printf>
    exit();
    262f:	e8 d0 06 00 00       	call   2d04 <exit>
  if(unlink(".") == 0){
    printf(1, "rm . worked!\n");
    exit();
  }
  if(unlink("..") == 0){
    printf(1, "rm .. worked!\n");
    2634:	c7 44 24 04 c9 3b 00 	movl   $0x3bc9,0x4(%esp)
    263b:	00 
    263c:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2643:	e8 08 08 00 00       	call   2e50 <printf>
    exit();
    2648:	e8 b7 06 00 00       	call   2d04 <exit>
  if(chdir("dots") != 0){
    printf(1, "chdir dots failed\n");
    exit();
  }
  if(unlink(".") == 0){
    printf(1, "rm . worked!\n");
    264d:	c7 44 24 04 bb 3b 00 	movl   $0x3bbb,0x4(%esp)
    2654:	00 
    2655:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    265c:	e8 ef 07 00 00       	call   2e50 <printf>
    exit();
    2661:	e8 9e 06 00 00       	call   2d04 <exit>
  if(mkdir("dots") != 0){
    printf(1, "mkdir dots failed\n");
    exit();
  }
  if(chdir("dots") != 0){
    printf(1, "chdir dots failed\n");
    2666:	c7 44 24 04 a8 3b 00 	movl   $0x3ba8,0x4(%esp)
    266d:	00 
    266e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2675:	e8 d6 07 00 00       	call   2e50 <printf>
    exit();
    267a:	e8 85 06 00 00       	call   2d04 <exit>
    267f:	90                   	nop

00002680 <dirfile>:
  printf(1, "rmdot ok\n");
}

void
dirfile(void)
{
    2680:	53                   	push   %ebx
    2681:	83 ec 18             	sub    $0x18,%esp
  int fd;

  printf(1, "dir vs file\n");
    2684:	c7 44 24 04 47 3c 00 	movl   $0x3c47,0x4(%esp)
    268b:	00 
    268c:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2693:	e8 b8 07 00 00       	call   2e50 <printf>

  fd = open("dirfile", O_CREATE);
    2698:	c7 44 24 04 00 02 00 	movl   $0x200,0x4(%esp)
    269f:	00 
    26a0:	c7 04 24 54 3c 00 00 	movl   $0x3c54,(%esp)
    26a7:	e8 98 06 00 00       	call   2d44 <open>
  if(fd < 0){
    26ac:	85 c0                	test   %eax,%eax
    26ae:	0f 88 4d 01 00 00    	js     2801 <dirfile+0x181>
    printf(1, "create dirfile failed\n");
    exit();
  }
  close(fd);
    26b4:	89 04 24             	mov    %eax,(%esp)
    26b7:	e8 70 06 00 00       	call   2d2c <close>
  if(chdir("dirfile") == 0){
    26bc:	c7 04 24 54 3c 00 00 	movl   $0x3c54,(%esp)
    26c3:	e8 ac 06 00 00       	call   2d74 <chdir>
    26c8:	85 c0                	test   %eax,%eax
    26ca:	0f 84 18 01 00 00    	je     27e8 <dirfile+0x168>
    printf(1, "chdir dirfile succeeded!\n");
    exit();
  }
  fd = open("dirfile/xx", 0);
    26d0:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    26d7:	00 
    26d8:	c7 04 24 8d 3c 00 00 	movl   $0x3c8d,(%esp)
    26df:	e8 60 06 00 00       	call   2d44 <open>
  if(fd >= 0){
    26e4:	85 c0                	test   %eax,%eax
    26e6:	0f 89 e3 00 00 00    	jns    27cf <dirfile+0x14f>
    printf(1, "create dirfile/xx succeeded!\n");
    exit();
  }
  fd = open("dirfile/xx", O_CREATE);
    26ec:	c7 44 24 04 00 02 00 	movl   $0x200,0x4(%esp)
    26f3:	00 
    26f4:	c7 04 24 8d 3c 00 00 	movl   $0x3c8d,(%esp)
    26fb:	e8 44 06 00 00       	call   2d44 <open>
  if(fd >= 0){
    2700:	85 c0                	test   %eax,%eax
    2702:	0f 89 c7 00 00 00    	jns    27cf <dirfile+0x14f>
    printf(1, "create dirfile/xx succeeded!\n");
    exit();
  }
  if(mkdir("dirfile/xx") == 0){
    2708:	c7 04 24 8d 3c 00 00 	movl   $0x3c8d,(%esp)
    270f:	e8 58 06 00 00       	call   2d6c <mkdir>
    2714:	85 c0                	test   %eax,%eax
    2716:	0f 84 7b 01 00 00    	je     2897 <dirfile+0x217>
    printf(1, "mkdir dirfile/xx succeeded!\n");
    exit();
  }
  if(unlink("dirfile/xx") == 0){
    271c:	c7 04 24 8d 3c 00 00 	movl   $0x3c8d,(%esp)
    2723:	e8 2c 06 00 00       	call   2d54 <unlink>
    2728:	85 c0                	test   %eax,%eax
    272a:	0f 84 4e 01 00 00    	je     287e <dirfile+0x1fe>
    printf(1, "unlink dirfile/xx succeeded!\n");
    exit();
  }
  if(link("README", "dirfile/xx") == 0){
    2730:	c7 44 24 04 8d 3c 00 	movl   $0x3c8d,0x4(%esp)
    2737:	00 
    2738:	c7 04 24 f1 3c 00 00 	movl   $0x3cf1,(%esp)
    273f:	e8 20 06 00 00       	call   2d64 <link>
    2744:	85 c0                	test   %eax,%eax
    2746:	0f 84 19 01 00 00    	je     2865 <dirfile+0x1e5>
    printf(1, "link to dirfile/xx succeeded!\n");
    exit();
  }
  if(unlink("dirfile") != 0){
    274c:	c7 04 24 54 3c 00 00 	movl   $0x3c54,(%esp)
    2753:	e8 fc 05 00 00       	call   2d54 <unlink>
    2758:	85 c0                	test   %eax,%eax
    275a:	0f 85 ec 00 00 00    	jne    284c <dirfile+0x1cc>
    printf(1, "unlink dirfile failed!\n");
    exit();
  }

  fd = open(".", O_RDWR);
    2760:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
    2767:	00 
    2768:	c7 04 24 8a 38 00 00 	movl   $0x388a,(%esp)
    276f:	e8 d0 05 00 00       	call   2d44 <open>
  if(fd >= 0){
    2774:	85 c0                	test   %eax,%eax
    2776:	0f 89 b7 00 00 00    	jns    2833 <dirfile+0x1b3>
    printf(1, "open . for writing succeeded!\n");
    exit();
  }
  fd = open(".", 0);
    277c:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    2783:	00 
    2784:	c7 04 24 8a 38 00 00 	movl   $0x388a,(%esp)
    278b:	e8 b4 05 00 00       	call   2d44 <open>
  if(write(fd, "x", 1) > 0){
    2790:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
    2797:	00 
    2798:	c7 44 24 04 6d 39 00 	movl   $0x396d,0x4(%esp)
    279f:	00 
  fd = open(".", O_RDWR);
  if(fd >= 0){
    printf(1, "open . for writing succeeded!\n");
    exit();
  }
  fd = open(".", 0);
    27a0:	89 c3                	mov    %eax,%ebx
  if(write(fd, "x", 1) > 0){
    27a2:	89 04 24             	mov    %eax,(%esp)
    27a5:	e8 7a 05 00 00       	call   2d24 <write>
    27aa:	85 c0                	test   %eax,%eax
    27ac:	7f 6c                	jg     281a <dirfile+0x19a>
    printf(1, "write . succeeded!\n");
    exit();
  }
  close(fd);
    27ae:	89 1c 24             	mov    %ebx,(%esp)
    27b1:	e8 76 05 00 00       	call   2d2c <close>

  printf(1, "dir vs file OK\n");
    27b6:	c7 44 24 04 24 3d 00 	movl   $0x3d24,0x4(%esp)
    27bd:	00 
    27be:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    27c5:	e8 86 06 00 00       	call   2e50 <printf>
}
    27ca:	83 c4 18             	add    $0x18,%esp
    27cd:	5b                   	pop    %ebx
    27ce:	c3                   	ret    
    printf(1, "create dirfile/xx succeeded!\n");
    exit();
  }
  fd = open("dirfile/xx", O_CREATE);
  if(fd >= 0){
    printf(1, "create dirfile/xx succeeded!\n");
    27cf:	c7 44 24 04 98 3c 00 	movl   $0x3c98,0x4(%esp)
    27d6:	00 
    27d7:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    27de:	e8 6d 06 00 00       	call   2e50 <printf>
    exit();
    27e3:	e8 1c 05 00 00       	call   2d04 <exit>
    printf(1, "create dirfile failed\n");
    exit();
  }
  close(fd);
  if(chdir("dirfile") == 0){
    printf(1, "chdir dirfile succeeded!\n");
    27e8:	c7 44 24 04 73 3c 00 	movl   $0x3c73,0x4(%esp)
    27ef:	00 
    27f0:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    27f7:	e8 54 06 00 00       	call   2e50 <printf>
    exit();
    27fc:	e8 03 05 00 00       	call   2d04 <exit>

  printf(1, "dir vs file\n");

  fd = open("dirfile", O_CREATE);
  if(fd < 0){
    printf(1, "create dirfile failed\n");
    2801:	c7 44 24 04 5c 3c 00 	movl   $0x3c5c,0x4(%esp)
    2808:	00 
    2809:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2810:	e8 3b 06 00 00       	call   2e50 <printf>
    exit();
    2815:	e8 ea 04 00 00       	call   2d04 <exit>
    printf(1, "open . for writing succeeded!\n");
    exit();
  }
  fd = open(".", 0);
  if(write(fd, "x", 1) > 0){
    printf(1, "write . succeeded!\n");
    281a:	c7 44 24 04 10 3d 00 	movl   $0x3d10,0x4(%esp)
    2821:	00 
    2822:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2829:	e8 22 06 00 00       	call   2e50 <printf>
    exit();
    282e:	e8 d1 04 00 00       	call   2d04 <exit>
    exit();
  }

  fd = open(".", O_RDWR);
  if(fd >= 0){
    printf(1, "open . for writing succeeded!\n");
    2833:	c7 44 24 04 e4 42 00 	movl   $0x42e4,0x4(%esp)
    283a:	00 
    283b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2842:	e8 09 06 00 00       	call   2e50 <printf>
    exit();
    2847:	e8 b8 04 00 00       	call   2d04 <exit>
  if(link("README", "dirfile/xx") == 0){
    printf(1, "link to dirfile/xx succeeded!\n");
    exit();
  }
  if(unlink("dirfile") != 0){
    printf(1, "unlink dirfile failed!\n");
    284c:	c7 44 24 04 f8 3c 00 	movl   $0x3cf8,0x4(%esp)
    2853:	00 
    2854:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    285b:	e8 f0 05 00 00       	call   2e50 <printf>
    exit();
    2860:	e8 9f 04 00 00       	call   2d04 <exit>
  if(unlink("dirfile/xx") == 0){
    printf(1, "unlink dirfile/xx succeeded!\n");
    exit();
  }
  if(link("README", "dirfile/xx") == 0){
    printf(1, "link to dirfile/xx succeeded!\n");
    2865:	c7 44 24 04 c4 42 00 	movl   $0x42c4,0x4(%esp)
    286c:	00 
    286d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2874:	e8 d7 05 00 00       	call   2e50 <printf>
    exit();
    2879:	e8 86 04 00 00       	call   2d04 <exit>
  if(mkdir("dirfile/xx") == 0){
    printf(1, "mkdir dirfile/xx succeeded!\n");
    exit();
  }
  if(unlink("dirfile/xx") == 0){
    printf(1, "unlink dirfile/xx succeeded!\n");
    287e:	c7 44 24 04 d3 3c 00 	movl   $0x3cd3,0x4(%esp)
    2885:	00 
    2886:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    288d:	e8 be 05 00 00       	call   2e50 <printf>
    exit();
    2892:	e8 6d 04 00 00       	call   2d04 <exit>
  if(fd >= 0){
    printf(1, "create dirfile/xx succeeded!\n");
    exit();
  }
  if(mkdir("dirfile/xx") == 0){
    printf(1, "mkdir dirfile/xx succeeded!\n");
    2897:	c7 44 24 04 b6 3c 00 	movl   $0x3cb6,0x4(%esp)
    289e:	00 
    289f:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    28a6:	e8 a5 05 00 00       	call   2e50 <printf>
    exit();
    28ab:	e8 54 04 00 00       	call   2d04 <exit>

000028b0 <iref>:
}

// test that iput() is called at the end of _namei()
void
iref(void)
{
    28b0:	53                   	push   %ebx
  int i, fd;

  printf(1, "empty file name\n");
    28b1:	bb 33 00 00 00       	mov    $0x33,%ebx
}

// test that iput() is called at the end of _namei()
void
iref(void)
{
    28b6:	83 ec 18             	sub    $0x18,%esp
  int i, fd;

  printf(1, "empty file name\n");
    28b9:	c7 44 24 04 34 3d 00 	movl   $0x3d34,0x4(%esp)
    28c0:	00 
    28c1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    28c8:	e8 83 05 00 00       	call   2e50 <printf>
    28cd:	8d 76 00             	lea    0x0(%esi),%esi

  // the 50 is NINODE
  for(i = 0; i < 50 + 1; i++){
    if(mkdir("irefd") != 0){
    28d0:	c7 04 24 45 3d 00 00 	movl   $0x3d45,(%esp)
    28d7:	e8 90 04 00 00       	call   2d6c <mkdir>
    28dc:	85 c0                	test   %eax,%eax
    28de:	0f 85 ae 00 00 00    	jne    2992 <iref+0xe2>
      printf(1, "mkdir irefd failed\n");
      exit();
    }
    if(chdir("irefd") != 0){
    28e4:	c7 04 24 45 3d 00 00 	movl   $0x3d45,(%esp)
    28eb:	e8 84 04 00 00       	call   2d74 <chdir>
    28f0:	85 c0                	test   %eax,%eax
    28f2:	0f 85 b3 00 00 00    	jne    29ab <iref+0xfb>
      printf(1, "chdir irefd failed\n");
      exit();
    }

    mkdir("");
    28f8:	c7 04 24 63 34 00 00 	movl   $0x3463,(%esp)
    28ff:	e8 68 04 00 00       	call   2d6c <mkdir>
    link("README", "");
    2904:	c7 44 24 04 63 34 00 	movl   $0x3463,0x4(%esp)
    290b:	00 
    290c:	c7 04 24 f1 3c 00 00 	movl   $0x3cf1,(%esp)
    2913:	e8 4c 04 00 00       	call   2d64 <link>
    fd = open("", O_CREATE);
    2918:	c7 44 24 04 00 02 00 	movl   $0x200,0x4(%esp)
    291f:	00 
    2920:	c7 04 24 63 34 00 00 	movl   $0x3463,(%esp)
    2927:	e8 18 04 00 00       	call   2d44 <open>
    if(fd >= 0)
    292c:	85 c0                	test   %eax,%eax
    292e:	78 08                	js     2938 <iref+0x88>
      close(fd);
    2930:	89 04 24             	mov    %eax,(%esp)
    2933:	e8 f4 03 00 00       	call   2d2c <close>
    fd = open("xx", O_CREATE);
    2938:	c7 44 24 04 00 02 00 	movl   $0x200,0x4(%esp)
    293f:	00 
    2940:	c7 04 24 6c 39 00 00 	movl   $0x396c,(%esp)
    2947:	e8 f8 03 00 00       	call   2d44 <open>
    if(fd >= 0)
    294c:	85 c0                	test   %eax,%eax
    294e:	78 08                	js     2958 <iref+0xa8>
      close(fd);
    2950:	89 04 24             	mov    %eax,(%esp)
    2953:	e8 d4 03 00 00       	call   2d2c <close>
    unlink("xx");
    2958:	c7 04 24 6c 39 00 00 	movl   $0x396c,(%esp)
    295f:	e8 f0 03 00 00       	call   2d54 <unlink>
  int i, fd;

  printf(1, "empty file name\n");

  // the 50 is NINODE
  for(i = 0; i < 50 + 1; i++){
    2964:	83 eb 01             	sub    $0x1,%ebx
    2967:	0f 85 63 ff ff ff    	jne    28d0 <iref+0x20>
    if(fd >= 0)
      close(fd);
    unlink("xx");
  }

  chdir("/");
    296d:	c7 04 24 d8 3b 00 00 	movl   $0x3bd8,(%esp)
    2974:	e8 fb 03 00 00       	call   2d74 <chdir>
  printf(1, "empty file name OK\n");
    2979:	c7 44 24 04 73 3d 00 	movl   $0x3d73,0x4(%esp)
    2980:	00 
    2981:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2988:	e8 c3 04 00 00       	call   2e50 <printf>
}
    298d:	83 c4 18             	add    $0x18,%esp
    2990:	5b                   	pop    %ebx
    2991:	c3                   	ret    
  printf(1, "empty file name\n");

  // the 50 is NINODE
  for(i = 0; i < 50 + 1; i++){
    if(mkdir("irefd") != 0){
      printf(1, "mkdir irefd failed\n");
    2992:	c7 44 24 04 4b 3d 00 	movl   $0x3d4b,0x4(%esp)
    2999:	00 
    299a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    29a1:	e8 aa 04 00 00       	call   2e50 <printf>
      exit();
    29a6:	e8 59 03 00 00       	call   2d04 <exit>
    }
    if(chdir("irefd") != 0){
      printf(1, "chdir irefd failed\n");
    29ab:	c7 44 24 04 5f 3d 00 	movl   $0x3d5f,0x4(%esp)
    29b2:	00 
    29b3:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    29ba:	e8 91 04 00 00       	call   2e50 <printf>
      exit();
    29bf:	e8 40 03 00 00       	call   2d04 <exit>
    29c4:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    29ca:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

000029d0 <forktest>:
// test that fork fails gracefully
// the forktest binary also does this, but it runs out of proc entries first.
// inside the bigger usertests binary, we run out of memory first.
void
forktest(void)
{
    29d0:	53                   	push   %ebx
  int n, pid;

  printf(1, "fork test\n");

  for(n=0; n<1000; n++){
    29d1:	31 db                	xor    %ebx,%ebx
// test that fork fails gracefully
// the forktest binary also does this, but it runs out of proc entries first.
// inside the bigger usertests binary, we run out of memory first.
void
forktest(void)
{
    29d3:	83 ec 18             	sub    $0x18,%esp
  int n, pid;

  printf(1, "fork test\n");
    29d6:	c7 44 24 04 87 3d 00 	movl   $0x3d87,0x4(%esp)
    29dd:	00 
    29de:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    29e5:	e8 66 04 00 00       	call   2e50 <printf>
    29ea:	eb 16                	jmp    2a02 <forktest+0x32>
    29ec:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

  for(n=0; n<1000; n++){
    pid = fork();
    if(pid < 0)
      break;
    if(pid == 0)
    29f0:	0f 84 87 00 00 00    	je     2a7d <forktest+0xad>
{
  int n, pid;

  printf(1, "fork test\n");

  for(n=0; n<1000; n++){
    29f6:	83 c3 01             	add    $0x1,%ebx
    29f9:	81 fb e8 03 00 00    	cmp    $0x3e8,%ebx
    29ff:	90                   	nop
    2a00:	74 4e                	je     2a50 <forktest+0x80>
    pid = fork();
    2a02:	e8 f5 02 00 00       	call   2cfc <fork>
    if(pid < 0)
    2a07:	83 f8 00             	cmp    $0x0,%eax
    2a0a:	7d e4                	jge    29f0 <forktest+0x20>
  if(n == 1000){
    printf(1, "fork claimed to work 1000 times!\n");
    exit();
  }
  
  for(; n > 0; n--){
    2a0c:	85 db                	test   %ebx,%ebx
    2a0e:	66 90                	xchg   %ax,%ax
    2a10:	74 15                	je     2a27 <forktest+0x57>
    2a12:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    if(wait() < 0){
    2a18:	e8 ef 02 00 00       	call   2d0c <wait>
    2a1d:	85 c0                	test   %eax,%eax
    2a1f:	90                   	nop
    2a20:	78 47                	js     2a69 <forktest+0x99>
  if(n == 1000){
    printf(1, "fork claimed to work 1000 times!\n");
    exit();
  }
  
  for(; n > 0; n--){
    2a22:	83 eb 01             	sub    $0x1,%ebx
    2a25:	75 f1                	jne    2a18 <forktest+0x48>
      printf(1, "wait stopped early\n");
      exit();
    }
  }
  
  if(wait() != -1){
    2a27:	e8 e0 02 00 00       	call   2d0c <wait>
    2a2c:	83 f8 ff             	cmp    $0xffffffff,%eax
    2a2f:	90                   	nop
    2a30:	75 50                	jne    2a82 <forktest+0xb2>
    printf(1, "wait got too many\n");
    exit();
  }
  
  printf(1, "fork test OK\n");
    2a32:	c7 44 24 04 b9 3d 00 	movl   $0x3db9,0x4(%esp)
    2a39:	00 
    2a3a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2a41:	e8 0a 04 00 00       	call   2e50 <printf>
}
    2a46:	83 c4 18             	add    $0x18,%esp
    2a49:	5b                   	pop    %ebx
    2a4a:	c3                   	ret    
    2a4b:	90                   	nop
    2a4c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    if(pid == 0)
      exit();
  }
  
  if(n == 1000){
    printf(1, "fork claimed to work 1000 times!\n");
    2a50:	c7 44 24 04 04 43 00 	movl   $0x4304,0x4(%esp)
    2a57:	00 
    2a58:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2a5f:	e8 ec 03 00 00       	call   2e50 <printf>
    exit();
    2a64:	e8 9b 02 00 00       	call   2d04 <exit>
  }
  
  for(; n > 0; n--){
    if(wait() < 0){
      printf(1, "wait stopped early\n");
    2a69:	c7 44 24 04 92 3d 00 	movl   $0x3d92,0x4(%esp)
    2a70:	00 
    2a71:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2a78:	e8 d3 03 00 00       	call   2e50 <printf>
      exit();
    2a7d:	e8 82 02 00 00       	call   2d04 <exit>
    }
  }
  
  if(wait() != -1){
    printf(1, "wait got too many\n");
    2a82:	c7 44 24 04 a6 3d 00 	movl   $0x3da6,0x4(%esp)
    2a89:	00 
    2a8a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2a91:	e8 ba 03 00 00       	call   2e50 <printf>
    exit();
    2a96:	e8 69 02 00 00       	call   2d04 <exit>
    2a9b:	90                   	nop
    2a9c:	90                   	nop
    2a9d:	90                   	nop
    2a9e:	90                   	nop
    2a9f:	90                   	nop

00002aa0 <strcpy>:
#include "user.h"
#include "x86.h"

char*
strcpy(char *s, char *t)
{
    2aa0:	53                   	push   %ebx
    2aa1:	8b 44 24 08          	mov    0x8(%esp),%eax
  char *os;

  os = s;
  while((*s++ = *t++) != 0)
    2aa5:	31 d2                	xor    %edx,%edx
#include "user.h"
#include "x86.h"

char*
strcpy(char *s, char *t)
{
    2aa7:	8b 5c 24 0c          	mov    0xc(%esp),%ebx
    2aab:	90                   	nop
    2aac:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  char *os;

  os = s;
  while((*s++ = *t++) != 0)
    2ab0:	0f b6 0c 13          	movzbl (%ebx,%edx,1),%ecx
    2ab4:	88 0c 10             	mov    %cl,(%eax,%edx,1)
    2ab7:	83 c2 01             	add    $0x1,%edx
    2aba:	84 c9                	test   %cl,%cl
    2abc:	75 f2                	jne    2ab0 <strcpy+0x10>
    ;
  return os;
}
    2abe:	5b                   	pop    %ebx
    2abf:	c3                   	ret    

00002ac0 <strcmp>:

int
strcmp(const char *p, const char *q)
{
    2ac0:	56                   	push   %esi
    2ac1:	53                   	push   %ebx
    2ac2:	8b 4c 24 0c          	mov    0xc(%esp),%ecx
    2ac6:	8b 54 24 10          	mov    0x10(%esp),%edx
  while(*p && *p == *q)
    2aca:	0f b6 01             	movzbl (%ecx),%eax
    2acd:	0f b6 1a             	movzbl (%edx),%ebx
    2ad0:	84 c0                	test   %al,%al
    2ad2:	74 24                	je     2af8 <strcmp+0x38>
    2ad4:	38 d8                	cmp    %bl,%al
    2ad6:	74 11                	je     2ae9 <strcmp+0x29>
    2ad8:	eb 2e                	jmp    2b08 <strcmp+0x48>
    2ada:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    2ae0:	83 c1 01             	add    $0x1,%ecx
    2ae3:	38 d8                	cmp    %bl,%al
    2ae5:	75 21                	jne    2b08 <strcmp+0x48>
    p++, q++;
    2ae7:	89 f2                	mov    %esi,%edx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
    2ae9:	0f b6 41 01          	movzbl 0x1(%ecx),%eax
    p++, q++;
    2aed:	8d 72 01             	lea    0x1(%edx),%esi
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
    2af0:	0f b6 5a 01          	movzbl 0x1(%edx),%ebx
    2af4:	84 c0                	test   %al,%al
    2af6:	75 e8                	jne    2ae0 <strcmp+0x20>
    p++, q++;
  return (uchar)*p - (uchar)*q;
    2af8:	0f b6 db             	movzbl %bl,%ebx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
    2afb:	31 c0                	xor    %eax,%eax
    p++, q++;
  return (uchar)*p - (uchar)*q;
    2afd:	29 d8                	sub    %ebx,%eax
}
    2aff:	5b                   	pop    %ebx
    2b00:	5e                   	pop    %esi
    2b01:	c3                   	ret    
    2b02:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
    p++, q++;
  return (uchar)*p - (uchar)*q;
    2b08:	0f b6 db             	movzbl %bl,%ebx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
    2b0b:	0f b6 c0             	movzbl %al,%eax
    p++, q++;
  return (uchar)*p - (uchar)*q;
    2b0e:	29 d8                	sub    %ebx,%eax
}
    2b10:	5b                   	pop    %ebx
    2b11:	5e                   	pop    %esi
    2b12:	c3                   	ret    
    2b13:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    2b19:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00002b20 <strlen>:

uint
strlen(char *s)
{
    2b20:	8b 4c 24 04          	mov    0x4(%esp),%ecx
  int n;

  for(n = 0; s[n]; n++)
    2b24:	31 c0                	xor    %eax,%eax
    2b26:	80 39 00             	cmpb   $0x0,(%ecx)
    2b29:	74 10                	je     2b3b <strlen+0x1b>
    2b2b:	31 d2                	xor    %edx,%edx
    2b2d:	8d 76 00             	lea    0x0(%esi),%esi
    2b30:	83 c2 01             	add    $0x1,%edx
    2b33:	80 3c 11 00          	cmpb   $0x0,(%ecx,%edx,1)
    2b37:	89 d0                	mov    %edx,%eax
    2b39:	75 f5                	jne    2b30 <strlen+0x10>
    ;
  return n;
}
    2b3b:	f3 c3                	repz ret 
    2b3d:	8d 76 00             	lea    0x0(%esi),%esi

00002b40 <memset>:

void*
memset(void *dst, int c, uint n)
{
    2b40:	57                   	push   %edi
    2b41:	8b 54 24 08          	mov    0x8(%esp),%edx
}

static inline void
stosb(void *addr, int data, int cnt)
{
  asm volatile("cld; rep stosb" :
    2b45:	8b 4c 24 10          	mov    0x10(%esp),%ecx
    2b49:	8b 44 24 0c          	mov    0xc(%esp),%eax
    2b4d:	89 d7                	mov    %edx,%edi
    2b4f:	fc                   	cld    
    2b50:	f3 aa                	rep stos %al,%es:(%edi)
  stosb(dst, c, n);
  return dst;
}
    2b52:	89 d0                	mov    %edx,%eax
    2b54:	5f                   	pop    %edi
    2b55:	c3                   	ret    
    2b56:	8d 76 00             	lea    0x0(%esi),%esi
    2b59:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00002b60 <strchr>:

char*
strchr(const char *s, char c)
{
    2b60:	8b 44 24 04          	mov    0x4(%esp),%eax
    2b64:	0f b6 4c 24 08       	movzbl 0x8(%esp),%ecx
  for(; *s; s++)
    2b69:	0f b6 10             	movzbl (%eax),%edx
    2b6c:	84 d2                	test   %dl,%dl
    2b6e:	74 1d                	je     2b8d <strchr+0x2d>
    if(*s == c)
    2b70:	38 ca                	cmp    %cl,%dl
    2b72:	75 0e                	jne    2b82 <strchr+0x22>
    2b74:	eb 1c                	jmp    2b92 <strchr+0x32>
    2b76:	66 90                	xchg   %ax,%ax
}

char*
strchr(const char *s, char c)
{
  for(; *s; s++)
    2b78:	83 c0 01             	add    $0x1,%eax
    if(*s == c)
    2b7b:	38 ca                	cmp    %cl,%dl
    2b7d:	8d 76 00             	lea    0x0(%esi),%esi
    2b80:	74 0e                	je     2b90 <strchr+0x30>
}

char*
strchr(const char *s, char c)
{
  for(; *s; s++)
    2b82:	0f b6 50 01          	movzbl 0x1(%eax),%edx
    2b86:	84 d2                	test   %dl,%dl
    2b88:	75 ee                	jne    2b78 <strchr+0x18>
    if(*s == c)
      return (char*) s;
  return 0;
    2b8a:	31 c0                	xor    %eax,%eax
    2b8c:	c3                   	ret    
    2b8d:	31 c0                	xor    %eax,%eax
    2b8f:	90                   	nop
}
    2b90:	f3 c3                	repz ret 
    2b92:	f3 c3                	repz ret 
    2b94:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    2b9a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00002ba0 <gets>:

char*
gets(char *buf, int max)
{
    2ba0:	55                   	push   %ebp
    2ba1:	57                   	push   %edi
    2ba2:	56                   	push   %esi
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
    2ba3:	31 f6                	xor    %esi,%esi
  return 0;
}

char*
gets(char *buf, int max)
{
    2ba5:	53                   	push   %ebx
    2ba6:	83 ec 2c             	sub    $0x2c,%esp
    2ba9:	8b 7c 24 40          	mov    0x40(%esp),%edi
    2bad:	8b 6c 24 44          	mov    0x44(%esp),%ebp
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
    2bb1:	eb 38                	jmp    2beb <gets+0x4b>
    2bb3:	90                   	nop
    2bb4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    cc = read(0, &c, 1);
    2bb8:	8d 44 24 1f          	lea    0x1f(%esp),%eax
    2bbc:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
    2bc3:	00 
    2bc4:	89 44 24 04          	mov    %eax,0x4(%esp)
    2bc8:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
    2bcf:	e8 48 01 00 00       	call   2d1c <read>
    if(cc < 1)
    2bd4:	85 c0                	test   %eax,%eax
    2bd6:	7e 1a                	jle    2bf2 <gets+0x52>
      break;
    buf[i++] = c;
    2bd8:	0f b6 44 24 1f       	movzbl 0x1f(%esp),%eax
gets(char *buf, int max)
{
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
    2bdd:	89 de                	mov    %ebx,%esi
    cc = read(0, &c, 1);
    if(cc < 1)
      break;
    buf[i++] = c;
    if(c == '\n' || c == '\r')
    2bdf:	3c 0d                	cmp    $0xd,%al

  for(i=0; i+1 < max; ){
    cc = read(0, &c, 1);
    if(cc < 1)
      break;
    buf[i++] = c;
    2be1:	88 44 1f ff          	mov    %al,-0x1(%edi,%ebx,1)
    if(c == '\n' || c == '\r')
    2be5:	74 0b                	je     2bf2 <gets+0x52>
    2be7:	3c 0a                	cmp    $0xa,%al
    2be9:	74 07                	je     2bf2 <gets+0x52>
gets(char *buf, int max)
{
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
    2beb:	8d 5e 01             	lea    0x1(%esi),%ebx
    2bee:	39 eb                	cmp    %ebp,%ebx
    2bf0:	7c c6                	jl     2bb8 <gets+0x18>
      break;
    buf[i++] = c;
    if(c == '\n' || c == '\r')
      break;
  }
  buf[i] = '\0';
    2bf2:	c6 04 37 00          	movb   $0x0,(%edi,%esi,1)
  return buf;
}
    2bf6:	83 c4 2c             	add    $0x2c,%esp
    2bf9:	89 f8                	mov    %edi,%eax
    2bfb:	5b                   	pop    %ebx
    2bfc:	5e                   	pop    %esi
    2bfd:	5f                   	pop    %edi
    2bfe:	5d                   	pop    %ebp
    2bff:	c3                   	ret    

00002c00 <stat>:

int
stat(char *n, struct statt *st)
{
    2c00:	83 ec 1c             	sub    $0x1c,%esp
  int fd;
  int r;

  fd = open(n, O_RDONLY);
    2c03:	8b 44 24 20          	mov    0x20(%esp),%eax
  return buf;
}

int
stat(char *n, struct statt *st)
{
    2c07:	89 5c 24 14          	mov    %ebx,0x14(%esp)
    2c0b:	89 74 24 18          	mov    %esi,0x18(%esp)
  int fd;
  int r;

  fd = open(n, O_RDONLY);
  if(fd < 0)
    return -1;
    2c0f:	be ff ff ff ff       	mov    $0xffffffff,%esi
stat(char *n, struct statt *st)
{
  int fd;
  int r;

  fd = open(n, O_RDONLY);
    2c14:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
    2c1b:	00 
    2c1c:	89 04 24             	mov    %eax,(%esp)
    2c1f:	e8 20 01 00 00       	call   2d44 <open>
  if(fd < 0)
    2c24:	85 c0                	test   %eax,%eax
stat(char *n, struct statt *st)
{
  int fd;
  int r;

  fd = open(n, O_RDONLY);
    2c26:	89 c3                	mov    %eax,%ebx
  if(fd < 0)
    2c28:	78 1a                	js     2c44 <stat+0x44>
    return -1;
  r = fstat(fd, st);
    2c2a:	8b 44 24 24          	mov    0x24(%esp),%eax
    2c2e:	89 1c 24             	mov    %ebx,(%esp)
    2c31:	89 44 24 04          	mov    %eax,0x4(%esp)
    2c35:	e8 22 01 00 00       	call   2d5c <fstat>
  close(fd);
    2c3a:	89 1c 24             	mov    %ebx,(%esp)
  int r;

  fd = open(n, O_RDONLY);
  if(fd < 0)
    return -1;
  r = fstat(fd, st);
    2c3d:	89 c6                	mov    %eax,%esi
  close(fd);
    2c3f:	e8 e8 00 00 00       	call   2d2c <close>
  return r;
}
    2c44:	89 f0                	mov    %esi,%eax
    2c46:	8b 5c 24 14          	mov    0x14(%esp),%ebx
    2c4a:	8b 74 24 18          	mov    0x18(%esp),%esi
    2c4e:	83 c4 1c             	add    $0x1c,%esp
    2c51:	c3                   	ret    
    2c52:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
    2c59:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00002c60 <atoi>:

int
atoi(const char *s)
{
    2c60:	53                   	push   %ebx
    2c61:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  int n;

  n = 0;
    2c65:	31 c0                	xor    %eax,%eax
  while('0' <= *s && *s <= '9')
    2c67:	0f b6 11             	movzbl (%ecx),%edx
    2c6a:	8d 5a d0             	lea    -0x30(%edx),%ebx
    2c6d:	80 fb 09             	cmp    $0x9,%bl
    2c70:	77 1e                	ja     2c90 <atoi+0x30>
    2c72:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    n = n*10 + *s++ - '0';
    2c78:	0f be d2             	movsbl %dl,%edx
    2c7b:	83 c1 01             	add    $0x1,%ecx
    2c7e:	8d 04 80             	lea    (%eax,%eax,4),%eax
    2c81:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
  int n;

  n = 0;
  while('0' <= *s && *s <= '9')
    2c85:	0f b6 11             	movzbl (%ecx),%edx
    2c88:	8d 5a d0             	lea    -0x30(%edx),%ebx
    2c8b:	80 fb 09             	cmp    $0x9,%bl
    2c8e:	76 e8                	jbe    2c78 <atoi+0x18>
    n = n*10 + *s++ - '0';
  return n;
}
    2c90:	5b                   	pop    %ebx
    2c91:	c3                   	ret    
    2c92:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
    2c99:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00002ca0 <memmove>:

void*
memmove(void *vdst, void *vsrc, int n)
{
    2ca0:	56                   	push   %esi
    2ca1:	53                   	push   %ebx
    2ca2:	8b 5c 24 14          	mov    0x14(%esp),%ebx
    2ca6:	8b 44 24 0c          	mov    0xc(%esp),%eax
    2caa:	8b 74 24 10          	mov    0x10(%esp),%esi
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
    2cae:	85 db                	test   %ebx,%ebx
    2cb0:	7e 14                	jle    2cc6 <memmove+0x26>
    n = n*10 + *s++ - '0';
  return n;
}

void*
memmove(void *vdst, void *vsrc, int n)
    2cb2:	31 d2                	xor    %edx,%edx
    2cb4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
    *dst++ = *src++;
    2cb8:	0f b6 0c 16          	movzbl (%esi,%edx,1),%ecx
    2cbc:	88 0c 10             	mov    %cl,(%eax,%edx,1)
    2cbf:	83 c2 01             	add    $0x1,%edx
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
    2cc2:	39 da                	cmp    %ebx,%edx
    2cc4:	75 f2                	jne    2cb8 <memmove+0x18>
    *dst++ = *src++;
  return vdst;
}
    2cc6:	5b                   	pop    %ebx
    2cc7:	5e                   	pop    %esi
    2cc8:	c3                   	ret    
    2cc9:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00002cd0 <memcpy>:

void *
memcpy(void *dst, const void *src, uint n)
{
    2cd0:	56                   	push   %esi
    2cd1:	53                   	push   %ebx
    2cd2:	8b 5c 24 14          	mov    0x14(%esp),%ebx
    2cd6:	8b 44 24 0c          	mov    0xc(%esp),%eax
    2cda:	8b 74 24 10          	mov    0x10(%esp),%esi
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
    2cde:	85 db                	test   %ebx,%ebx
    2ce0:	7e 14                	jle    2cf6 <memcpy+0x26>
    2ce2:	31 d2                	xor    %edx,%edx
    2ce4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    *dst++ = *src++;
    2ce8:	0f b6 0c 16          	movzbl (%esi,%edx,1),%ecx
    2cec:	88 0c 10             	mov    %cl,(%eax,%edx,1)
    2cef:	83 c2 01             	add    $0x1,%edx
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
    2cf2:	39 da                	cmp    %ebx,%edx
    2cf4:	75 f2                	jne    2ce8 <memcpy+0x18>

void *
memcpy(void *dst, const void *src, uint n)
{
  return memmove(dst, src, n);
}
    2cf6:	5b                   	pop    %ebx
    2cf7:	5e                   	pop    %esi
    2cf8:	c3                   	ret    
    2cf9:	90                   	nop
    2cfa:	90                   	nop
    2cfb:	90                   	nop

00002cfc <fork>:
    2cfc:	b8 01 00 00 00       	mov    $0x1,%eax
    2d01:	cd 40                	int    $0x40
    2d03:	c3                   	ret    

00002d04 <exit>:
    2d04:	b8 02 00 00 00       	mov    $0x2,%eax
    2d09:	cd 40                	int    $0x40
    2d0b:	c3                   	ret    

00002d0c <wait>:
    2d0c:	b8 03 00 00 00       	mov    $0x3,%eax
    2d11:	cd 40                	int    $0x40
    2d13:	c3                   	ret    

00002d14 <pipe>:
    2d14:	b8 04 00 00 00       	mov    $0x4,%eax
    2d19:	cd 40                	int    $0x40
    2d1b:	c3                   	ret    

00002d1c <read>:
    2d1c:	b8 06 00 00 00       	mov    $0x6,%eax
    2d21:	cd 40                	int    $0x40
    2d23:	c3                   	ret    

00002d24 <write>:
    2d24:	b8 05 00 00 00       	mov    $0x5,%eax
    2d29:	cd 40                	int    $0x40
    2d2b:	c3                   	ret    

00002d2c <close>:
    2d2c:	b8 07 00 00 00       	mov    $0x7,%eax
    2d31:	cd 40                	int    $0x40
    2d33:	c3                   	ret    

00002d34 <kill>:
    2d34:	b8 08 00 00 00       	mov    $0x8,%eax
    2d39:	cd 40                	int    $0x40
    2d3b:	c3                   	ret    

00002d3c <exec>:
    2d3c:	b8 09 00 00 00       	mov    $0x9,%eax
    2d41:	cd 40                	int    $0x40
    2d43:	c3                   	ret    

00002d44 <open>:
    2d44:	b8 0a 00 00 00       	mov    $0xa,%eax
    2d49:	cd 40                	int    $0x40
    2d4b:	c3                   	ret    

00002d4c <mknod>:
    2d4c:	b8 0b 00 00 00       	mov    $0xb,%eax
    2d51:	cd 40                	int    $0x40
    2d53:	c3                   	ret    

00002d54 <unlink>:
    2d54:	b8 0c 00 00 00       	mov    $0xc,%eax
    2d59:	cd 40                	int    $0x40
    2d5b:	c3                   	ret    

00002d5c <fstat>:
    2d5c:	b8 0d 00 00 00       	mov    $0xd,%eax
    2d61:	cd 40                	int    $0x40
    2d63:	c3                   	ret    

00002d64 <link>:
    2d64:	b8 0e 00 00 00       	mov    $0xe,%eax
    2d69:	cd 40                	int    $0x40
    2d6b:	c3                   	ret    

00002d6c <mkdir>:
    2d6c:	b8 0f 00 00 00       	mov    $0xf,%eax
    2d71:	cd 40                	int    $0x40
    2d73:	c3                   	ret    

00002d74 <chdir>:
    2d74:	b8 10 00 00 00       	mov    $0x10,%eax
    2d79:	cd 40                	int    $0x40
    2d7b:	c3                   	ret    

00002d7c <dup>:
    2d7c:	b8 11 00 00 00       	mov    $0x11,%eax
    2d81:	cd 40                	int    $0x40
    2d83:	c3                   	ret    

00002d84 <getpid>:
    2d84:	b8 12 00 00 00       	mov    $0x12,%eax
    2d89:	cd 40                	int    $0x40
    2d8b:	c3                   	ret    

00002d8c <sbrk>:
    2d8c:	b8 13 00 00 00       	mov    $0x13,%eax
    2d91:	cd 40                	int    $0x40
    2d93:	c3                   	ret    

00002d94 <sleep>:
    2d94:	b8 14 00 00 00       	mov    $0x14,%eax
    2d99:	cd 40                	int    $0x40
    2d9b:	c3                   	ret    
    2d9c:	90                   	nop
    2d9d:	90                   	nop
    2d9e:	90                   	nop
    2d9f:	90                   	nop

00002da0 <putc>:
#include "stat.h"
#include "user.h"

static void
putc(int fd, char c)
{
    2da0:	83 ec 2c             	sub    $0x2c,%esp
    2da3:	88 54 24 1c          	mov    %dl,0x1c(%esp)
  write(fd, &c, 1);
    2da7:	8d 54 24 1c          	lea    0x1c(%esp),%edx
    2dab:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
    2db2:	00 
    2db3:	89 54 24 04          	mov    %edx,0x4(%esp)
    2db7:	89 04 24             	mov    %eax,(%esp)
    2dba:	e8 65 ff ff ff       	call   2d24 <write>
}
    2dbf:	83 c4 2c             	add    $0x2c,%esp
    2dc2:	c3                   	ret    
    2dc3:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    2dc9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00002dd0 <printint>:

static void
printint(int fd, int xx, int base, int sgn)
{
    2dd0:	57                   	push   %edi
    2dd1:	56                   	push   %esi
    2dd2:	53                   	push   %ebx
    2dd3:	89 c3                	mov    %eax,%ebx
    2dd5:	83 ec 10             	sub    $0x10,%esp
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
  if(sgn && xx < 0){
    2dd8:	8b 44 24 20          	mov    0x20(%esp),%eax
    2ddc:	85 c0                	test   %eax,%eax
    2dde:	74 60                	je     2e40 <printint+0x70>
    2de0:	89 d0                	mov    %edx,%eax
    2de2:	c1 e8 1f             	shr    $0x1f,%eax
    2de5:	84 c0                	test   %al,%al
    2de7:	74 57                	je     2e40 <printint+0x70>
    neg = 1;
    x = -xx;
    2de9:	89 d0                	mov    %edx,%eax
  int i, neg;
  uint x;

  neg = 0;
  if(sgn && xx < 0){
    neg = 1;
    2deb:	bf 01 00 00 00       	mov    $0x1,%edi
    x = -xx;
    2df0:	f7 d8                	neg    %eax
  } else {
    x = xx;
  }

  i = 0;
    2df2:	31 f6                	xor    %esi,%esi
    2df4:	eb 04                	jmp    2dfa <printint+0x2a>
    2df6:	66 90                	xchg   %ax,%ax
  do{
    buf[i++] = digits[x % base];
    2df8:	89 d6                	mov    %edx,%esi
    2dfa:	31 d2                	xor    %edx,%edx
    2dfc:	f7 f1                	div    %ecx
    2dfe:	0f b6 92 5b 43 00 00 	movzbl 0x435b(%edx),%edx
  }while((x /= base) != 0);
    2e05:	85 c0                	test   %eax,%eax
    x = xx;
  }

  i = 0;
  do{
    buf[i++] = digits[x % base];
    2e07:	88 14 34             	mov    %dl,(%esp,%esi,1)
    2e0a:	8d 56 01             	lea    0x1(%esi),%edx
  }while((x /= base) != 0);
    2e0d:	75 e9                	jne    2df8 <printint+0x28>
  if(neg)
    2e0f:	85 ff                	test   %edi,%edi
    2e11:	74 07                	je     2e1a <printint+0x4a>
    buf[i++] = '-';
    2e13:	c6 04 14 2d          	movb   $0x2d,(%esp,%edx,1)
    2e17:	8d 56 02             	lea    0x2(%esi),%edx

  while(--i >= 0)
    2e1a:	8d 72 ff             	lea    -0x1(%edx),%esi
    2e1d:	8d 76 00             	lea    0x0(%esi),%esi
    putc(fd, buf[i]);
    2e20:	0f be 14 34          	movsbl (%esp,%esi,1),%edx
    2e24:	89 d8                	mov    %ebx,%eax
    buf[i++] = digits[x % base];
  }while((x /= base) != 0);
  if(neg)
    buf[i++] = '-';

  while(--i >= 0)
    2e26:	83 ee 01             	sub    $0x1,%esi
    putc(fd, buf[i]);
    2e29:	e8 72 ff ff ff       	call   2da0 <putc>
    buf[i++] = digits[x % base];
  }while((x /= base) != 0);
  if(neg)
    buf[i++] = '-';

  while(--i >= 0)
    2e2e:	83 fe ff             	cmp    $0xffffffff,%esi
    2e31:	75 ed                	jne    2e20 <printint+0x50>
    putc(fd, buf[i]);
}
    2e33:	83 c4 10             	add    $0x10,%esp
    2e36:	5b                   	pop    %ebx
    2e37:	5e                   	pop    %esi
    2e38:	5f                   	pop    %edi
    2e39:	c3                   	ret    
    2e3a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  neg = 0;
  if(sgn && xx < 0){
    neg = 1;
    x = -xx;
  } else {
    x = xx;
    2e40:	89 d0                	mov    %edx,%eax
  static char digits[] = "0123456789ABCDEF";
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
    2e42:	31 ff                	xor    %edi,%edi
    2e44:	eb ac                	jmp    2df2 <printint+0x22>
    2e46:	8d 76 00             	lea    0x0(%esi),%esi
    2e49:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00002e50 <printf>:
}

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
    2e50:	55                   	push   %ebp
    2e51:	57                   	push   %edi
    2e52:	56                   	push   %esi
    2e53:	53                   	push   %ebx
    2e54:	83 ec 2c             	sub    $0x2c,%esp
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    2e57:	8b 5c 24 44          	mov    0x44(%esp),%ebx
}

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
    2e5b:	8b 6c 24 40          	mov    0x40(%esp),%ebp
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    2e5f:	0f b6 0b             	movzbl (%ebx),%ecx
    2e62:	84 c9                	test   %cl,%cl
    2e64:	0f 84 86 00 00 00    	je     2ef0 <printf+0xa0>
  char *s;
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
    2e6a:	8d 44 24 48          	lea    0x48(%esp),%eax
{
  char *s;
  int c, i, state;
  uint *ap;

  state = 0;
    2e6e:	31 f6                	xor    %esi,%esi
  ap = (uint*)(void*)&fmt + 1;
    2e70:	89 44 24 1c          	mov    %eax,0x1c(%esp)
    2e74:	eb 1b                	jmp    2e91 <printf+0x41>
    2e76:	66 90                	xchg   %ax,%ax
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
    2e78:	83 f9 25             	cmp    $0x25,%ecx
    2e7b:	74 7b                	je     2ef8 <printf+0xa8>
        state = '%';
      } else {
        putc(fd, c);
    2e7d:	0f be d1             	movsbl %cl,%edx
    2e80:	89 e8                	mov    %ebp,%eax
    2e82:	e8 19 ff ff ff       	call   2da0 <putc>
      } else if(c == '%'){
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
    2e87:	83 c3 01             	add    $0x1,%ebx
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    2e8a:	0f b6 0b             	movzbl (%ebx),%ecx
    2e8d:	84 c9                	test   %cl,%cl
    2e8f:	74 5f                	je     2ef0 <printf+0xa0>
    c = fmt[i] & 0xff;
    if(state == 0){
    2e91:	85 f6                	test   %esi,%esi
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
    2e93:	0f b6 c9             	movzbl %cl,%ecx
    if(state == 0){
    2e96:	74 e0                	je     2e78 <printf+0x28>
      if(c == '%'){
        state = '%';
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
    2e98:	83 fe 25             	cmp    $0x25,%esi
    2e9b:	75 ea                	jne    2e87 <printf+0x37>
      if(c == 'd'){
    2e9d:	83 f9 64             	cmp    $0x64,%ecx
    2ea0:	0f 84 ba 00 00 00    	je     2f60 <printf+0x110>
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
    2ea6:	83 f9 70             	cmp    $0x70,%ecx
    2ea9:	74 55                	je     2f00 <printf+0xb0>
    2eab:	83 f9 78             	cmp    $0x78,%ecx
    2eae:	66 90                	xchg   %ax,%ax
    2eb0:	74 4e                	je     2f00 <printf+0xb0>
        printint(fd, *ap, 16, 0);
        ap++;
      } else if(c == 's'){
    2eb2:	83 f9 73             	cmp    $0x73,%ecx
    2eb5:	74 71                	je     2f28 <printf+0xd8>
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
    2eb7:	83 f9 63             	cmp    $0x63,%ecx
    2eba:	0f 84 c3 00 00 00    	je     2f83 <printf+0x133>
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
    2ec0:	83 f9 25             	cmp    $0x25,%ecx
        putc(fd, c);
    2ec3:	ba 25 00 00 00       	mov    $0x25,%edx
    2ec8:	89 e8                	mov    %ebp,%eax
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
    2eca:	74 12                	je     2ede <printf+0x8e>
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
    2ecc:	89 4c 24 18          	mov    %ecx,0x18(%esp)
    2ed0:	e8 cb fe ff ff       	call   2da0 <putc>
        putc(fd, c);
    2ed5:	8b 4c 24 18          	mov    0x18(%esp),%ecx
    2ed9:	89 e8                	mov    %ebp,%eax
    2edb:	0f be d1             	movsbl %cl,%edx
    2ede:	e8 bd fe ff ff       	call   2da0 <putc>
      }
      state = 0;
    2ee3:	31 f6                	xor    %esi,%esi
      } else if(c == '%'){
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
    2ee5:	83 c3 01             	add    $0x1,%ebx
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    2ee8:	0f b6 0b             	movzbl (%ebx),%ecx
    2eeb:	84 c9                	test   %cl,%cl
    2eed:	75 a2                	jne    2e91 <printf+0x41>
    2eef:	90                   	nop
        putc(fd, c);
      }
      state = 0;
    }
  }
}
    2ef0:	83 c4 2c             	add    $0x2c,%esp
    2ef3:	5b                   	pop    %ebx
    2ef4:	5e                   	pop    %esi
    2ef5:	5f                   	pop    %edi
    2ef6:	5d                   	pop    %ebp
    2ef7:	c3                   	ret    
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
        state = '%';
    2ef8:	be 25 00 00 00       	mov    $0x25,%esi
    2efd:	eb 88                	jmp    2e87 <printf+0x37>
    2eff:	90                   	nop
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
        printint(fd, *ap, 16, 0);
    2f00:	8b 44 24 1c          	mov    0x1c(%esp),%eax
    2f04:	b9 10 00 00 00       	mov    $0x10,%ecx
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
    2f09:	31 f6                	xor    %esi,%esi
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
        printint(fd, *ap, 16, 0);
    2f0b:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
    2f12:	8b 10                	mov    (%eax),%edx
    2f14:	89 e8                	mov    %ebp,%eax
    2f16:	e8 b5 fe ff ff       	call   2dd0 <printint>
        ap++;
    2f1b:	83 44 24 1c 04       	addl   $0x4,0x1c(%esp)
    2f20:	e9 62 ff ff ff       	jmp    2e87 <printf+0x37>
    2f25:	8d 76 00             	lea    0x0(%esi),%esi
      } else if(c == 's'){
        s = (char*)*ap;
    2f28:	8b 44 24 1c          	mov    0x1c(%esp),%eax
    2f2c:	8b 38                	mov    (%eax),%edi
        ap++;
    2f2e:	83 c0 04             	add    $0x4,%eax
    2f31:	89 44 24 1c          	mov    %eax,0x1c(%esp)
        if(s == 0)
    2f35:	85 ff                	test   %edi,%edi
    2f37:	74 64                	je     2f9d <printf+0x14d>
          s = "(null)";
        while(*s != 0){
    2f39:	0f b6 17             	movzbl (%edi),%edx
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
    2f3c:	31 f6                	xor    %esi,%esi
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
    2f3e:	84 d2                	test   %dl,%dl
    2f40:	0f 84 41 ff ff ff    	je     2e87 <printf+0x37>
    2f46:	66 90                	xchg   %ax,%ax
          putc(fd, *s);
    2f48:	0f be d2             	movsbl %dl,%edx
          s++;
    2f4b:	83 c7 01             	add    $0x1,%edi
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
    2f4e:	89 e8                	mov    %ebp,%eax
    2f50:	e8 4b fe ff ff       	call   2da0 <putc>
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
    2f55:	0f b6 17             	movzbl (%edi),%edx
    2f58:	84 d2                	test   %dl,%dl
    2f5a:	75 ec                	jne    2f48 <printf+0xf8>
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
    2f5c:	31 f6                	xor    %esi,%esi
    2f5e:	eb 85                	jmp    2ee5 <printf+0x95>
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
    2f60:	8b 44 24 1c          	mov    0x1c(%esp),%eax
    2f64:	b1 0a                	mov    $0xa,%cl
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
    2f66:	66 31 f6             	xor    %si,%si
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
    2f69:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
    2f70:	8b 10                	mov    (%eax),%edx
    2f72:	89 e8                	mov    %ebp,%eax
    2f74:	e8 57 fe ff ff       	call   2dd0 <printint>
        ap++;
    2f79:	83 44 24 1c 04       	addl   $0x4,0x1c(%esp)
    2f7e:	e9 04 ff ff ff       	jmp    2e87 <printf+0x37>
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
    2f83:	8b 44 24 1c          	mov    0x1c(%esp),%eax
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
    2f87:	31 f6                	xor    %esi,%esi
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
    2f89:	0f be 10             	movsbl (%eax),%edx
    2f8c:	89 e8                	mov    %ebp,%eax
    2f8e:	e8 0d fe ff ff       	call   2da0 <putc>
        ap++;
    2f93:	83 44 24 1c 04       	addl   $0x4,0x1c(%esp)
    2f98:	e9 ea fe ff ff       	jmp    2e87 <printf+0x37>
        ap++;
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
    2f9d:	bf 54 43 00 00       	mov    $0x4354,%edi
    2fa2:	eb 95                	jmp    2f39 <printf+0xe9>
    2fa4:	90                   	nop
    2fa5:	90                   	nop
    2fa6:	90                   	nop
    2fa7:	90                   	nop
    2fa8:	90                   	nop
    2fa9:	90                   	nop
    2faa:	90                   	nop
    2fab:	90                   	nop
    2fac:	90                   	nop
    2fad:	90                   	nop
    2fae:	90                   	nop
    2faf:	90                   	nop

00002fb0 <free>:
static Header base;
static Header *freep;

void
free(void *ap)
{
    2fb0:	57                   	push   %edi
  Header *bp, *p;

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
    2fb1:	a1 c0 4a 00 00       	mov    0x4ac0,%eax
static Header base;
static Header *freep;

void
free(void *ap)
{
    2fb6:	56                   	push   %esi
    2fb7:	53                   	push   %ebx
    2fb8:	8b 5c 24 10          	mov    0x10(%esp),%ebx
  Header *bp, *p;

  bp = (Header*) ap - 1;
    2fbc:	8d 4b f8             	lea    -0x8(%ebx),%ecx
    2fbf:	90                   	nop
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
    2fc0:	39 c8                	cmp    %ecx,%eax
    2fc2:	8b 10                	mov    (%eax),%edx
    2fc4:	73 04                	jae    2fca <free+0x1a>
    2fc6:	39 d1                	cmp    %edx,%ecx
    2fc8:	72 16                	jb     2fe0 <free+0x30>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
    2fca:	39 d0                	cmp    %edx,%eax
    2fcc:	72 08                	jb     2fd6 <free+0x26>
    2fce:	39 c8                	cmp    %ecx,%eax
    2fd0:	72 0e                	jb     2fe0 <free+0x30>
    2fd2:	39 d1                	cmp    %edx,%ecx
    2fd4:	72 0a                	jb     2fe0 <free+0x30>
static Header base;
static Header *freep;

void
free(void *ap)
{
    2fd6:	89 d0                	mov    %edx,%eax
    2fd8:	eb e6                	jmp    2fc0 <free+0x10>
    2fda:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
      break;
  if(bp + bp->s.size == p->s.ptr){
    2fe0:	8b 73 fc             	mov    -0x4(%ebx),%esi
    2fe3:	8d 3c f1             	lea    (%ecx,%esi,8),%edi
    2fe6:	39 d7                	cmp    %edx,%edi
    2fe8:	74 18                	je     3002 <free+0x52>
    bp->s.size += p->s.ptr->s.size;
    bp->s.ptr = p->s.ptr->s.ptr;
  } else
    bp->s.ptr = p->s.ptr;
    2fea:	89 53 f8             	mov    %edx,-0x8(%ebx)
  if(p + p->s.size == bp){
    2fed:	8b 50 04             	mov    0x4(%eax),%edx
    2ff0:	8d 34 d0             	lea    (%eax,%edx,8),%esi
    2ff3:	39 f1                	cmp    %esi,%ecx
    2ff5:	74 22                	je     3019 <free+0x69>
    p->s.size += bp->s.size;
    p->s.ptr = bp->s.ptr;
  } else
    p->s.ptr = bp;
    2ff7:	89 08                	mov    %ecx,(%eax)
  freep = p;
    2ff9:	a3 c0 4a 00 00       	mov    %eax,0x4ac0
}
    2ffe:	5b                   	pop    %ebx
    2fff:	5e                   	pop    %esi
    3000:	5f                   	pop    %edi
    3001:	c3                   	ret    
  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
      break;
  if(bp + bp->s.size == p->s.ptr){
    bp->s.size += p->s.ptr->s.size;
    3002:	03 72 04             	add    0x4(%edx),%esi
    3005:	89 73 fc             	mov    %esi,-0x4(%ebx)
    bp->s.ptr = p->s.ptr->s.ptr;
    3008:	8b 10                	mov    (%eax),%edx
    300a:	8b 12                	mov    (%edx),%edx
    300c:	89 53 f8             	mov    %edx,-0x8(%ebx)
  } else
    bp->s.ptr = p->s.ptr;
  if(p + p->s.size == bp){
    300f:	8b 50 04             	mov    0x4(%eax),%edx
    3012:	8d 34 d0             	lea    (%eax,%edx,8),%esi
    3015:	39 f1                	cmp    %esi,%ecx
    3017:	75 de                	jne    2ff7 <free+0x47>
    p->s.size += bp->s.size;
    3019:	03 53 fc             	add    -0x4(%ebx),%edx
    p->s.ptr = bp->s.ptr;
  } else
    p->s.ptr = bp;
  freep = p;
    301c:	a3 c0 4a 00 00       	mov    %eax,0x4ac0
    bp->s.size += p->s.ptr->s.size;
    bp->s.ptr = p->s.ptr->s.ptr;
  } else
    bp->s.ptr = p->s.ptr;
  if(p + p->s.size == bp){
    p->s.size += bp->s.size;
    3021:	89 50 04             	mov    %edx,0x4(%eax)
    p->s.ptr = bp->s.ptr;
    3024:	8b 53 f8             	mov    -0x8(%ebx),%edx
    3027:	89 10                	mov    %edx,(%eax)
  } else
    p->s.ptr = bp;
  freep = p;
}
    3029:	5b                   	pop    %ebx
    302a:	5e                   	pop    %esi
    302b:	5f                   	pop    %edi
    302c:	c3                   	ret    
    302d:	8d 76 00             	lea    0x0(%esi),%esi

00003030 <malloc>:
  return freep;
}

void*
malloc(uint nbytes)
{
    3030:	57                   	push   %edi
    3031:	56                   	push   %esi
    3032:	53                   	push   %ebx
    3033:	83 ec 10             	sub    $0x10,%esp
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    3036:	8b 15 c0 4a 00 00    	mov    0x4ac0,%edx
malloc(uint nbytes)
{
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
    303c:	8b 5c 24 20          	mov    0x20(%esp),%ebx
    3040:	83 c3 07             	add    $0x7,%ebx
    3043:	c1 eb 03             	shr    $0x3,%ebx
    3046:	83 c3 01             	add    $0x1,%ebx
  if((prevp = freep) == 0){
    3049:	85 d2                	test   %edx,%edx
    304b:	0f 84 9d 00 00 00    	je     30ee <malloc+0xbe>
    3051:	8b 02                	mov    (%edx),%eax
    3053:	8b 48 04             	mov    0x4(%eax),%ecx
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
    3056:	39 d9                	cmp    %ebx,%ecx
    3058:	73 6e                	jae    30c8 <malloc+0x98>
        p->s.size -= nunits;
        p += p->s.size;
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
    305a:	8d 3c dd 00 00 00 00 	lea    0x0(,%ebx,8),%edi
    3061:	eb 0e                	jmp    3071 <malloc+0x41>
    3063:	90                   	nop
    3064:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    3068:	8b 02                	mov    (%edx),%eax
    if(p->s.size >= nunits){
    306a:	8b 48 04             	mov    0x4(%eax),%ecx
    306d:	39 cb                	cmp    %ecx,%ebx
    306f:	76 57                	jbe    30c8 <malloc+0x98>
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
    3071:	3b 05 c0 4a 00 00    	cmp    0x4ac0,%eax
    3077:	89 c2                	mov    %eax,%edx
    3079:	75 ed                	jne    3068 <malloc+0x38>
morecore(uint nu)
{
  char *p;
  Header *hp;

  if(nu < PAGE)
    307b:	81 fb ff 0f 00 00    	cmp    $0xfff,%ebx
    3081:	b8 00 80 00 00       	mov    $0x8000,%eax
    nu = PAGE;
    3086:	be 00 10 00 00       	mov    $0x1000,%esi
morecore(uint nu)
{
  char *p;
  Header *hp;

  if(nu < PAGE)
    308b:	76 04                	jbe    3091 <malloc+0x61>
    308d:	89 f8                	mov    %edi,%eax
    308f:	89 de                	mov    %ebx,%esi
    nu = PAGE;
  p = sbrk(nu * sizeof(Header));
    3091:	89 04 24             	mov    %eax,(%esp)
    3094:	e8 f3 fc ff ff       	call   2d8c <sbrk>
  if(p == (char*) -1)
    3099:	83 f8 ff             	cmp    $0xffffffff,%eax
    309c:	74 1a                	je     30b8 <malloc+0x88>
    return 0;
  hp = (Header*)p;
  hp->s.size = nu;
    309e:	89 70 04             	mov    %esi,0x4(%eax)
  free((void*)(hp + 1));
    30a1:	83 c0 08             	add    $0x8,%eax
    30a4:	89 04 24             	mov    %eax,(%esp)
    30a7:	e8 04 ff ff ff       	call   2fb0 <free>
  return freep;
    30ac:	8b 15 c0 4a 00 00    	mov    0x4ac0,%edx
      }
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
    30b2:	85 d2                	test   %edx,%edx
    30b4:	75 b2                	jne    3068 <malloc+0x38>
    30b6:	66 90                	xchg   %ax,%ax
        return 0;
  }
}
    30b8:	83 c4 10             	add    $0x10,%esp
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
    30bb:	31 c0                	xor    %eax,%eax
  }
}
    30bd:	5b                   	pop    %ebx
    30be:	5e                   	pop    %esi
    30bf:	5f                   	pop    %edi
    30c0:	c3                   	ret    
    30c1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
      if(p->s.size == nunits)
    30c8:	39 cb                	cmp    %ecx,%ebx
    30ca:	74 1c                	je     30e8 <malloc+0xb8>
        prevp->s.ptr = p->s.ptr;
      else {
        p->s.size -= nunits;
    30cc:	29 d9                	sub    %ebx,%ecx
    30ce:	89 48 04             	mov    %ecx,0x4(%eax)
        p += p->s.size;
    30d1:	8d 04 c8             	lea    (%eax,%ecx,8),%eax
        p->s.size = nunits;
    30d4:	89 58 04             	mov    %ebx,0x4(%eax)
      }
      freep = prevp;
    30d7:	89 15 c0 4a 00 00    	mov    %edx,0x4ac0
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
  }
}
    30dd:	83 c4 10             	add    $0x10,%esp
        p->s.size -= nunits;
        p += p->s.size;
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
    30e0:	83 c0 08             	add    $0x8,%eax
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
  }
}
    30e3:	5b                   	pop    %ebx
    30e4:	5e                   	pop    %esi
    30e5:	5f                   	pop    %edi
    30e6:	c3                   	ret    
    30e7:	90                   	nop
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
      if(p->s.size == nunits)
        prevp->s.ptr = p->s.ptr;
    30e8:	8b 08                	mov    (%eax),%ecx
    30ea:	89 0a                	mov    %ecx,(%edx)
    30ec:	eb e9                	jmp    30d7 <malloc+0xa7>
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
    30ee:	c7 05 c0 4a 00 00 c4 	movl   $0x4ac4,0x4ac0
    30f5:	4a 00 00 
    base.s.size = 0;
    30f8:	b8 c4 4a 00 00       	mov    $0x4ac4,%eax
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
    30fd:	c7 05 c4 4a 00 00 c4 	movl   $0x4ac4,0x4ac4
    3104:	4a 00 00 
    base.s.size = 0;
    3107:	c7 05 c8 4a 00 00 00 	movl   $0x0,0x4ac8
    310e:	00 00 00 
    3111:	e9 44 ff ff ff       	jmp    305a <malloc+0x2a>
